Skip to main content

NPU Quick Validation

This document provides an out-of-the-box example of ResNet50 object detection model inference, showcasing hardware-accelerated inference using the Qualcomm® Hexagon™ Processor (NPU) on a Radxa Dragon Ubuntu system.

Download Example

Device
pip3 install modelscope
modelscope download --model radxa/resnet50_qairt --local ./resnet50_qairt

Run Example

Select the appropriate folder based on your SoC platform:

Device
cd resnet50_qairt/6490
./qnn-net-run --backend ./libQnnHtp.so --retrieve_context ./resnet50_aimet_quantized_6490.bin --input_list ./test_list.txt --output_dir output_bin

Verify Results

You can verify the results using a Python script:

Device
cd scripts
python3 show_resnet50_classifications.py --input_list ../model/test_list.txt -o ../model/output_bin/ --labels_file ../data/imagenet_classes.txt
$ python3 show_resnet50_classifications.py --input_list ../model/test_list.txt -o ../model/output_bin/ --labels_file ../data/imagenet_classes.txt
Classification results
../data/test/crop/ILSVRC2012_val_00003441.raw 21.740574 402 acoustic guitar
../data/test/crop/ILSVRC2012_val_00008465.raw 23.423716 927 trifle
../data/test/crop/ILSVRC2012_val_00010218.raw 12.623559 281 tabby
../data/test/crop/ILSVRC2012_val_00044076.raw 18.093769 376 proboscis monkey

By comparing the printed results with the test image content, we can confirm that the ResNet50 model has been successfully ported to the Qualcomm® NPU with correct output.

ResNet50 Input Images