跳到主要内容

Shufflenet-v2 示例

此文档讲述使用 QAI AppBuilder Python API 利用 Qualcomm® Hexagon™ Processor (NPU) 推理 Shufflenet-v2 目标识别模型。

示例支持设备

设备SoC
Dragon Q6AQCS6490
Dragon Q8BSC8280XP

安装 QAI AppBuilder

提示
  1. 请根据 QAI AppBuilder 安装方法 安装 QAI AppBuilder。

  2. 请根据 创建 ADSP 环境变量 配置 ADSP 环境变量。

运行示例

安装依赖

Device
pip3 install requests tqdm qai-hub py3_wget opencv-python torch torchvision

运行脚本

  • 进入示例目录

    Device
    cd ai-engine-direct-helper/samples/linux/python
  • 准备输入图片,这里以以下图片为输入示例

    input image

  • 执行推理

    Device
    python3 shufflenet_v2/shufflenet_v2.py
    $ python3 shufflenet_v2/shufflenet_v2.py
    Current file directory: /mnt/ssd/qualcomm/701/zzf_fork/ai-engine-direct-helper/samples/linux/python/shufflenet_v2
    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

    115.6ms [WARNING] Time: Read model file to memory. 0.91

    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

    125.6ms [WARNING] Time: contextCreateFromBinary. 10.02

    125.7ms [WARNING] Time: UnmapViewOfFile. 0.00

    125.9ms [WARNING] Time: model_initialize shufflenet_v2 125.87

    199.9ms [WARNING] Time: model_inference shufflenet_v2 2.19

    Top 5 predictions for image:

    Samoyed 0.8289067745
    wallaby 0.0915796161
    Pomeranian 0.0265247617
    Great Pyrenees 0.0101179369
    hare 0.0050830133
    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
    219.4ms [WARNING] Time: model_destroy shufflenet_v2 17.56

    打印结果可以看到 Samoyed 置信度最高,这与输入图片内容吻合。

    您需要登录 GitHub 才能发表评论。如果您已登录,请忽略此消息。

    Radxa-docs © 2026 by Radxa Computer (Shenzhen) Co.,Ltd. is licensed under CC BY 4.0