NPU Ascend example#
Note. This example shows how to use FaceEngineSDK on NPU Ascend.
What it does#
This example demonstrates how to use FaceEngineSDK build for Atlas platform.
Prerequisites#
This example assumes that you have already read the FaceEngine Handbook (or at least have it somewhere nearby for reference) and know some core concepts, like memory management, object ownership, and life-time control. This sample will not explain these aspects in detail.
How to run#
Use the following commands to run the example.
Run the command from ”FSDK_ROOT”.
An example of use with one image. Batch size is an optional parameter. By default, it equals to 1.
<install_prefix>/example_npu_ascend --image <some_image.ppm>
An example of use with batch filled by the same image.
<install_prefix>/example_npu_ascend --image <some_image.ppm> --batchSize 4
An example of use with the batch of images with default batchSize.
<install_prefix>/example_npu_ascend --imageList <someImageList.txt>
An example of use with the batch of images from passed list.
<install_prefix>/example_npu_ascend --imageList <someImageList.txt> --batchSize 3
Running the example without parameters is incorrect.
Example of a list of images:
/home/user/images/image_1.jpg
/home/user/images/image_2.jpg
/home/user/images/image_3.jpg
/home/user/images/image_4.jpg
/home/user/images/image_5.jpg
/home/user/images/image_6.jpg
Image paths must be absolute or relative to the working directory.
Example output#
Image id = 0, Face id = 0, Descriptor id = 0
Detect Face bounding box coordinates:
x = 277, y = 426, width = 77, height = 98, score = 0.99995
Redetect Face bounding box coordinates:
x = 276, y = 426, width = 77, height = 98, score = 0.999225
Face landmarks 5:
x = 19.183 y = 38.3762
x = 51.8333 y = 37.9828
x = 34.6695 y = 60.5359
x = 18.871 y = 70.5423
x = 52.8976 y = 70.2192
Best shot quality estimation:
Head pose estimation: yaw = 4.01095, pitch = 9.25828, roll = -0.0123044
AGS: value = 0.553711
Head pose estimation: yaw = 3.39119, pitch = 10.6144, roll = -1.0529
AGS: value = 0.983758
Medical mask estimation:
result = OccludedFace, scores: mask = 5.6954e-07, no mask = 0.000115112, mask not in place = 3.30989e-07, occluded face = 0.999884
Image id = 0, Face id = 1, Descriptor id = 1
Detect Face bounding box coordinates:
x = 200, y = 162, width = 71, height = 89, score = 0.999853
Redetect Face bounding box coordinates:
x = 198, y = 160, width = 71, height = 88, score = 0.998932
Face landmarks 5:
x = 22.8254 y = 33.0806
x = 53.9319 y = 35.1562
x = 40.0574 y = 51.1595
x = 19.4035 y = 62.0824
x = 51.2553 y = 63.9501
Best shot quality estimation:
Head pose estimation: yaw = -6.24438, pitch = 4.35233, roll = 3.97016
AGS: value = 0.440153
Head pose estimation: yaw = -7.20653, pitch = 6.75446, roll = 3.08184
AGS: value = 0.982735
Medical mask estimation:
result = NoMask, scores: mask = 0.000118957, no mask = 0.718065, mask not in place = 0.000524984, occluded face = 0.281291
Descriptors 0 and 0 are matched with similarity 100%
Descriptors 0 and 1 are matched with similarity 15.978%
Descriptors 1 and 1 are matched with similarity 100%