Image Classification application for Windows on Snapdragon® with ResNet101 using ONNX runtime.
ResNet101 is a machine learning model that can classify images from the Imagenet dataset. It can also be used as a backbone in building more complex models for specific use cases. Optimized for Qualcomm Compute platform, this application enables real-time image classification.
This Python application demonstrates how to use QNN Execution Provider to accelerate the model using the Snapdragon® Neural Processing Unit (NPU).
- Windows on Snapdragon® (Qualcommm 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
- pillow
-
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
Download ResNet101 ONNX model for Compute from Qualcomm AI Hub. Extract the zip file and place model files into ./assets/ directory.
Prepare your test image assets and place into ./assets/ directory.
Model input resolution is 224 x 224.
If input image is in different resolution, it will be resized to 224 x 224.
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.
- ONNX model from Qualcomm AI Hub and test images :
./assets/
Open your terminal and navigate to the project directory.
pip install numpy onnxruntime-qnn pillowRun the application with default QNN libraries from onnxruntime-qnn package.
You may change the path if needed.
python .\Image_Classification_ONNX.py --onnx_path .\assets\model.onnxYou can also run the application with a specific version of QNN libraries.
python .\Image_Classification_ONNX.py --onnx_path .\assets\model.onnx --qnn_path C:\Qualcomm\AIStack\QAIRT\2.39.0.250926\lib\arm64x-windows-msvc\QnnHtp.dllEnter the path to the image file (or type 'exit' to quit): ./assets/keyboard.jpg


