Object detection application for Windows on Snapdragon® with YOLOv8-Detection using ONNX runtime.
Ultralytics YOLOv8 is a machine learning model that predicts object bounding boxes and classes in images. Optimized for Qualcomm Compute platform, this application enables real-time object detection.
This Python application demonstrates how to use QNN Execution Provider to accelerate the model using the Snapdragon® Neural Processing Unit (NPU).
- Windows on Snapdragon® (Qualcomm Compute platform, e.g. X Elite and X Plus)
- Windows 11
- This application is tested on ASUS Vivobook S15 (S5507).
-
Python
- This application is tested with Python 3.10.9.
- Download and install Python 3.10.9 64-bit on your Windows on Snapdragon.
- Required packages.
- numpy
- onnxruntime-qnn
- opencv-python
-
Qualcomm AI Runtime SDK : QNN SDK
- The required QNN dependency libraries are included in onnxruntime-qnn package.
- If you plan to use a specific version of QNN libraries, download and install Qualcomm AI Runtime SDK from Qualcomm Software Center.

- This Python application is tested with default QNN libraries from onnxruntime-qnn and QNN v2.39.0.250926.
- Find your
QNN_SDK_ROOT. For example,QNN_SDK_ROOT = C:\Qualcomm\AIStack\QAIRT\2.39.0.250926. - Remember this directory if you plan to use a specific version of QNN libraries.
<QNN_SDK_ROOT>\lib\arm64x-windows-msvc
Set up Python environment as described in Qualcomm AI Hub.
Follow the instruction and run the export script to produce a model optimized for on-device deployment.
python -m qai_hub_models.models.yolov8_det.export --device "Snapdragon X Elite CRD" --target-runtime onnxAfter the compilation is finished, go to Qualcomm AI Hub Jobs page to check compiled result and download the ONNX model and model.data file to ./assets/ directory.
Prepare your video assets and place into ./assets/ directory.
Model input resolution is 640 x 640.
If input video is in different resolution, it will be resized to 640 x 640.
Please ensure that you have followed the section above and placed the following assets into the specific directory. You may change the directory if needed.
- Video assets :
./assets/ - ONNX model from Qualcomm AI Hub :
./assets/
Open your terminal and navigate to the project directory.
pip install numpy onnxruntime-qnn opencv-pythonThe default confidence threshold and IoU threshold for NMS are 0.5 and 0.4, respectively.
Run the application with default QNN libraries from onnxruntime-qnn package.
python .\Object_Detection_ONNX.py --onnx_path .\assets\model.onnx --video_path .\assets\people_run.mp4You can also run the application with a specific version of QNN libraries.
python .\Object_Detection_ONNX.py --onnx_path .\assets\model.onnx --video_path .\assets\people_run.mp4 --qnn_path C:\Qualcomm\AIStack\QAIRT\2.39.0.250926\lib\arm64x-windows-msvc\QnnHtp.dllRunning with the specified confidence and IoU thresholds for NMS.
python .\Object_Detection_ONNX.py --onnx_path .\assets\model.onnx --video_path .\assets\people_run.mp4 --conf_thres 0.6 --iou_thres 0.5Inference is accelerated by Snapdragon® Neural Processing Unit (NPU).

