How joireve/pedestriandetectionsystem works
This is a minimal C++ single-image pedestrian detector: a user supplies an ONNX model and image path, then the command-line entry loads the image, invokes the detector, annotates detections, and displays the result. The detector performs LetterBox preprocessing, OpenCV DNN blob conversion and inference, then decodes person detections, restores image coordinates, and applies NMS. Model export is a separate documented capability. The main runtime files were excerpted; the model artifact is documented but its contents were not inspected.
Main entry points: PedestrianDetector.hpp Detector API · main.cpp Image CLI · export_onnx.py ONNX exporter · PedestrianDetector.cpp DNN inference
Components 12
Image application
- Image CLI
src/main.cpp - Input image
- Annotate and display
src/main.cpp
Detection pipeline
- Detector API
include/PedestrianDetector.hpp - LetterBox preprocessing
src/PedestrianDetector.cpp - Blob conversion
src/PedestrianDetector.cpp - DNN inference
src/PedestrianDetector.cpp - Person decode and NMS
src/PedestrianDetector.cpp
Model artifact
- YOLOv8n ONNX
models/yolov8n.onnx - ONNX exporter
scripts/export_onnx.py - YOLO source weights
Other components
- Image user
Connections 12
- Image user → Image CLI: runs with paths
README.md - Image CLI → Input image: loads image
src/main.cpp - Image CLI → Detector API: calls detect
src/main.cpp - Detector API → LetterBox preprocessing: preprocesses
src/PedestrianDetector.cpp - Detector API → Blob conversion: converts input
src/PedestrianDetector.cpp - Detector API → DNN inference: runs forward
src/PedestrianDetector.cpp - Detector API → Person decode and NMS: postprocesses
src/PedestrianDetector.cpp - DNN inference → YOLOv8n ONNX: loads model
src/PedestrianDetector.cpp - Image CLI → Annotate and display: draws detections
src/main.cpp - Annotate and display → Input image: displays result
src/main.cpp - ONNX exporter → YOLO source weights: loads weights
scripts/export_onnx.py - ONNX exporter → YOLOv8n ONNX: exports model
scripts/export_onnx.py