A C++ desktop application for YOLOv8 object detection using Qt, OpenCV, and ONNX Runtime. The app supports webcam inference and single-image inference, and prints runtime metrics for comparison with the Python implementation.
- Real-time webcam object detection
- Static image detection through a file picker
- YOLOv8 ONNX Runtime inference on CPU
- COCO class labels with confidence scores
- Camera refresh and camera selection controls
- Console performance metrics for FPS, inference latency, CPU time, and memory use
.
├── CMakeLists.txt
├── models/
│ └── yolov8n.onnx
├── onnxruntime-linux-x64-1.20.1/
├── screenshots/
│ ├── home_page.png
│ └── live_inferencing.png
├── src/
│ ├── detector/
│ ├── gui/
│ └── main.cpp
└── yaml/
└── coco.names
- Linux x86_64
- CMake 3.16 or newer
- C++17 compiler
- Qt5 Widgets
- OpenCV
- ONNX Runtime 1.20.1
On Ubuntu/Debian:
sudo apt update
sudo apt install -y build-essential cmake qtbase5-dev libopencv-devcmake -S . -B build
cmake --build build -j$(nproc)./build/edgeai-appThe app loads:
- Model:
models/yolov8n.onnx - Classes:
yaml/coco.names
The app prints comparison-friendly metrics:
[C++] YOLO model load | model=... | load_ms=... | ready=true
[C++] Webcam performance | frames=30 | fps=... | avg_frame_ms=... | avg_inference_ms=... | detections=... | cpu_ms=... | max_rss_mb=...
[C++] Image performance | file=... | total_ms=... | inference_ms=... | detections=... | process_cpu_s=... | max_rss_mb=...
Use these values alongside the Python app logs for runtime comparison.
- OpenCV may print warnings while probing unavailable camera indexes.
build/is generated locally and ignored by git.- The current CMake file links against
onnxruntime-linux-x64-1.20.1/lib/libonnxruntime.so.

