Skip to main content

Facial-Attribute-Detection Example

This document describes how to use the QAI AppBuilder Python API to run inference with the Facial-Attribute-Detection face attribute recognition model on Qualcomm® Hexagon™ Processor (NPU).

Supported Devices

DeviceSoC
Fogwise® AIRbox Q900QCS9075

Install QAI AppBuilder

tip
  1. Please install QAI AppBuilder according to QAI AppBuilder Installation Guide.

  2. Please configure ADSP environment variables according to Create ADSP Environment Variables.

Run the Example

Install Dependencies

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

Run the Script

  • Navigate to the example directory

    Device
    cd ai-engine-direct-helper/samples/python
  • Prepare input image. The following image is used as an example:

    input image

  • Run inference

    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
  • Recognition results

    {
    "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]
    }

    You need to be logged into GitHub to post a comment. If you are already logged in, please ignore this message.

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