跳到主要内容

MediaPipe-Hand-Detection 示例

此文档讲述使用 QAI AppBuilder Python API 利用 Qualcomm® Hexagon™ Processor (NPU) 推理 MediaPipe-Hand-Detection 手部姿态识别模型。

示例支持设备

设备SoC
Fogwise® AIRbox Q900QCS9075

安装 QAI AppBuilder

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

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

运行示例

安装依赖

Device
pip3 install requests tqdm qai-hub py3_wget opencv-python torch torchvision matplotlib easyocr qai_hub_models pygame

运行脚本

  • 进入示例目录

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

    input image

  • 执行推理

    Device
    python3 mediapipe_hand/mediapipe_hand.py --imagefile ./mediapipe_hand/hand.jpg
    $ python3 mediapipe_hand/mediapipe_hand.py --imagefile ./mediapipe_hand/hand.jpg
    /mnt/ssd/qualcomm/702/zzf_fork/test/ai-engine-direct-helper/.venv/lib/python3.12/site-packages/pygame/pkgdata.py:25: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
    from pkg_resources import resource_stream, resource_exists
    pygame 2.6.1 (SDL 2.28.4, Python 3.12.3)
    Hello from the pygame community. https://www.pygame.org/contribute.html
    Press ESC key to exit if you are opening camera app.
    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.5.5/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

    110.2ms [WARNING] Time: Read model file to memory. 2.70

    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

    133.4ms [WARNING] Time: contextCreateFromBinary. 23.04

    133.4ms [WARNING] Time: UnmapViewOfFile. 0.00

    133.9ms [WARNING] Time: model_initialize hand_detector 133.82

    191.3ms [WARNING] Time: Read model file to memory. 3.24

    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

    204.0ms [WARNING] Time: contextCreateFromBinary. 12.63

    204.1ms [WARNING] Time: UnmapViewOfFile. 0.00

    205.1ms [WARNING] Time: model_initialize landmark_detector 17.40

    242.5ms [WARNING] Time: model_inference hand_detector 2.86

    255.1ms [WARNING] Time: model_inference landmark_detector 2.10

    /mnt/ssd/qualcomm/702/zzf_fork/test/ai-engine-direct-helper/samples/python/mediapipe_hand/mediapipe_hand.py:906: DeprecationWarning: 'mode' parameter is deprecated and will be removed in Pillow 13 (2026-10-15)
    out_image = Image.fromarray(pred_image[0], "RGB")

    Demo image display is disabled by default for remote servers. To override, set `QAIHM_ALWAYS_DISPLAY_OUTPUT=1` in your environment.

    Saving image to /mnt/ssd/qualcomm/702/zzf_fork/test/ai-engine-direct-helper/samples/python/build/image.png
    0.0ms [WARNING] <W> This META does not have Alloc2 Support

    0.0ms [WARNING] <W> This META does not have Alloc2 Support

    314.1ms [WARNING] Time: model_destroy hand_detector 11.84

    <W> Logs will be sent to the system's default channel
    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.5.5/ipc/fastrpc/rpcmem/src/rpcmem_android.c:42:dummy call to rpcmem_deinit, rpcmem APIs will be used from libxdsprpc
    389.4ms [WARNING] Time: model_destroy landmark_detector 75.05

    output image

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

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