WideResNet50 Example
This document describes using the QAI AppBuilder Python API to perform inference with the WideResNet50 target recognition model using Qualcomm® Hexagon™ Processor (NPU).
Supported Devices
| Device | SoC |
|---|---|
| Dragon Q6A | QCS6490 |
| Dragon Q8B | SC8280XP |
Install QAI AppBuilder
-
Please install QAI AppBuilder according to QAI AppBuilder Installation Guide.
-
Please configure ADSP environment variables according to Create ADSP Environment Variables.
Run Example
Install Dependencies
pip3 install requests tqdm qai-hub py3_wget opencv-python torch torchvision
Run Script
-
Navigate to the example directory
- QCS6490
- SC8280XP
Devicecd ai-engine-direct-helper/samples/linux/pythonDevicecd ai-engine-direct-helper/samples/linux/python -
Prepare input image, using the following image as input example

input image
-
Execute inference
Devicepython3 wideresnet50/wideresnet50.py$ python3 wideresnet50/wideresnet50.py
Current file directory: /mnt/ssd/qualcomm/701/zzf_fork/ai-engine-direct-helper/samples/linux/python/wideresnet50
0.0ms [WARNING] <W> Initializing HtpProvider
/prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.37.1/point_release/SNPE_SRC/avante-tools/prebuilt/dsp/hexagon-sdk-5.4.0/ipc/fastrpc/rpcmem/src/rpcmem_android.c:38:dummy call to rpcmem_init, rpcmem APIs will be used from libxdsprpc
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
146.7ms [WARNING] Time: Read model file to memory. 30.54
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
179.0ms [WARNING] Time: contextCreateFromBinary. 32.18
179.0ms [WARNING] Time: UnmapViewOfFile. 0.00
179.5ms [WARNING] Time: model_initialize wideresnet50 179.49
243.2ms [WARNING] Time: model_inference wideresnet50 9.66
Top 5 predictions for image:
Samoyed 0.8442133665
keeshond 0.0415370725
Pomeranian 0.0302517358
white wolf 0.0258170888
chow 0.0072637959
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
0.0ms [WARNING] <W> This META does not have Alloc2 Support
/prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.37.1/point_release/SNPE_SRC/avante-tools/prebuilt/dsp/hexagon-sdk-5.4.0/ipc/fastrpc/rpcmem/src/rpcmem_android.c:42:dummy call to rpcmem_deinit, rpcmem APIs will be used from libxdsprpc
258.1ms [WARNING] Time: model_destroy wideresnet50 11.75The printed results show that
Samoyedhas the highest confidence, which matches the input image content.