跳到主要内容

Facial-Attribute-Detection 示例

此文档讲述使用 QAI AppBuilder Python API 利用 Qualcomm® Hexagon™ Processor (NPU) 推理 Facial-Attribute-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

运行脚本

  • 进入示例目录

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

    input image

  • 执行推理

    Device
    python3 face_attrib_net/face_attrib_net.py --image ./face_attrib_net/test.jpeg
    $ python3 face_attrib_net/face_attrib_net.py --image ./face_attrib_net/test.jpeg
    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

    138.8ms [WARNING] Time: Read model file to memory. 17.12

    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

    171.9ms [WARNING] Time: contextCreateFromBinary. 33.00

    172.0ms [WARNING] Time: UnmapViewOfFile. 0.00

    173.7ms [WARNING] Time: model_initialize face_attrib_net 173.70

    206.7ms [WARNING] Time: model_inference face_attrib_net 2.68

    Model outputs are saved at: /mnt/ssd/qualcomm/702/zzf_fork/test/ai-engine-direct-helper/samples/python/face_attrib_net/build/output.json
    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
    304.2ms [WARNING] Time: model_destroy face_attrib_net 91.15
  • 识别结果

    {
    "id_feature": [
    -131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -110208.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    -131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, -65472.00390625,
    -131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, -131008.0078125, 85824.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -9096.0009765625, -131008.0078125, 131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, 73472.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    -87232.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, -109696.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -31408.001953125, -131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -50720.00390625,
    131008.0078125, 131008.0078125, 95104.0078125, -131008.0078125,
    -131008.0078125, -131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, -131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, 131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, 131008.0078125, 131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    -131008.0078125, -68864.0078125, -131008.0078125, -28160.001953125,
    131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, -629.5000610351562, 131008.0078125,
    -131008.0078125, 131008.0078125, 116608.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, -102656.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    -28240.001953125, 131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, -39840.00390625, -131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -40992.00390625, -131008.0078125, 131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, 111232.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, 73920.0078125,
    -131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, -131008.0078125,
    -131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, -131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, 131008.0078125,
    131008.0078125, 65184.00390625, -131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -129472.0078125, -131008.0078125, -131008.0078125, -131008.0078125,
    131008.0078125, -131008.0078125, 131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125,
    131008.0078125, 131008.0078125, -131008.0078125, -131008.0078125,
    -131008.0078125, 131008.0078125, 131008.0078125, 131008.0078125
    ],
    "liveness_feature": [
    10344.0009765625, 22816.001953125, -4112.00048828125, -13632.0009765625,
    8156.00048828125, -15176.0009765625, 7100.00048828125, 19952.001953125,
    7816.00048828125, 17936.001953125, -2642.000244140625, -3474.000244140625,
    -1823.0001220703125, 4340.00048828125, 8304.0009765625, 6308.00048828125,
    25936.001953125, -5192.00048828125, 7112.00048828125, 3862.000244140625,
    12288.0009765625, 2606.000244140625, -11192.0009765625, -8352.0009765625,
    8132.00048828125, 19664.001953125, -2890.000244140625, 1288.0001220703125,
    -7612.00048828125, -19664.001953125, 2094.000244140625, -10056.0009765625
    ],
    "eye_closeness": [131008.0078125, -131008.0078125],
    "glasses": [76608.0078125, -79488.0078125],
    "mask": [-86208.0078125, 67264.0078125],
    "sunglasses": [0.9985352158546448, 0.0]
    }

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

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