Face Recognition Algorithm
REVISION HISTORY¶
| Revision No. | Description |
Date |
|---|---|---|
| 100 | 04/27/2023 | |
| 101 | 07/04/2023 | |
| 102 | 05/20/2024 | |
| 200 | 08/01/2024 |
1. Algorithm Description¶
Face recognition primarily distinguishes between human faces and determines whether a captured face belongs to a whitelisted individual. The entire algorithm includes face detection, face attribute recognition, facial expression recognition, facial landmark detection, face filtering, face tracking, face alignment, feature extraction, and face comparison.
Among these, face attributes can determine five characteristics: glasses, gender, mask, beard, and age. Facial expression recognition identifies seven expressions: neutral, happy, sad, surprised, fearful, disgusted, and angry.
-
Algorithm Accuracy
ALGO Threshold 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 FR TAR% 99.4 98.9 98.5 98.1 97.6 96.9 96.4 95.2 93.9 93.4 92.1 90.9 89.1 86.7 85.4 84.2 FR FAR% 2.3 1.8 1 0.7 0.4 0.1 0 0 0 0 0 0 0 0 0 0 -
Model Introduction
model function input_size(w*h) input_format fr_det_y24s.img face detection 480*288 yuvsp420_nv12 fr_det_y36s.img face detection 640*352 yuvsp420_nv12 fr_det_y48s.img face detection 800*480 yuvsp420_nv12 fr_feature_as.img face feature extraction(small) 112*112 BGRA8888 fr_feature_am.img face feature extraction(medium) 112*112 BGRA8888 fr_feature_al.img face feature extraction(large) 112*112 BGRA8888 fr_angle_y66.img face angle estimation 64*64 yuvsp420_nv12 fr_cos256.img face feature compare 256*512 INT16 far101_224y_emo.img facial expression recognition 224*224 yuvsp420_nv12 far101_224y_emo_s45.img facial expression recognition(small) 224*224 yuvsp420_nv12 far103_224y.img facial attribute recognition 112*112 BGRA8888 fr_blur_as.img face blur estimation (small) 112*112 BGRA8888
2. API Workflow¶
Face recognition primarily involves two processes. The first one is face Registration, which generates a facial whitelist (face database). The second one is Face Recognition which identifies captured faces to determine if they belong to whitelisted individuals.
2.1. Face Registration Workflow¶
Face Registration API Workflow:ALGO_FR_CreateHandle → ALGO_FR_InitHandle → ALGO_FR_SetParams → ALGO_FR_GetInputAttr → ALGO_FR_Detect → ALGO_FR_AlignRegist → ALGO_FR_FeatureExtract. Finally save extracted features into face database.
2.2. Face Recognition Workflow¶
Face Recognition API Workflow:ALGO_FR_CreateHandle → ALGO_FR_InitHandle → ALGO_FR_SetParams → ALGO_FR_GetInputAttr → ALGO_FR_Detect → ALGO_FR_Align → ALGO_FR_FeatureExtract → ALGO_FR_FeatureCompare.Compare the features of the captured image with those in the database (whitelist) to determines whether it belongs to the same individual.
2.3. Facial Atrribute Recognition Workflow¶
Facial Atrribute Recognition Workflow:ALGO_FR_CreateHandle → ALGO_FR_InitHandle → ALGO_FR_SetParams → ALGO_FR_GetInputAttr → ALGO_FR_Detect → ALGO_FR_Attr.Facial attribute recognition is performed using captured face images.Note: Cropped face images input to this API must be expanded with a certain margin around the face area.The expansion margins should be set to 1.25 times the width (bbox_w) and height (bbox_h) of the original bounding box.
2.4. Face Blur Score Workflow¶
Face Blur Score API Workflow:ALGO_FR_CreateHandle → ALGO_FR_InitHandle → ALGO_FR_SetParams → ALGO_FR_GetInputAttr → ALGO_FR_Detect → ALGO_FR_Align → ALGO_FR_FaceBlur, send detected & aligned face area into ALGO_FR_FaceBlur to get Blur Score.
3. Function Module API¶
| API Name | function |
|---|---|
| ALGO_FR_CreateHandle | create handle |
| ALGO_FR_InitHandle | initialize handle |
| ALGO_FR_GetInputAttr | retrieve the model's input attributes |
| ALGO_FR_SetParams | set configurable params |
| ALGO_FR_Detect | face detection |
| ALGO_FR_Align | face alignment |
| ALGO_FR_Attr | facial attribute recognition |
| ALGO_FR_FaceQuality | face angle estimation and quality filtering |
| ALGO_FR_FeatureExtract | feature extraction |
| ALGO_FR_FeatureCompare | feature comparison |
| ALGO_FR_BatchFeatureCompare | batch facial feature comparison(need to make one feature copy) |
| ALGO_FR_BatchFeatureCompareV2 | batch facial feature comparison(no need to make feature copy) |
| ALGO_FR_DeinitHandle | de-initialize handle |
| ALGO_FR_ReleaseHandle | release handle |
| ALGO_FR_FaceBlur | get face blur score |
3.1. ALGO_FR_CreateHandle¶
-
function
create handle.
-
Syntax
MI_S32 ALGO_FR_CreateHandle(void **handle);
-
Parameters
Parameter Name Description Input/Output handle handle Input -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.2. ALGO_FR_InitHandle¶
-
function
initialize handle.
-
Syntax
MI_S32 ALGO_FR_InitHandle(void *handle, const FrInit_t *init_info);
-
Parameters
Parameter Name Description Input/Output handle handle Input init_info Algorithm initialization params, see FrInit_t for details Input -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
-
Usage Examples
{ int ret=0; FrInit_t initParam; std::string bin = "/config/dla/ipu_firmware.bin"; std::string detModelPath = "./models/fr_det_y24s.img"; std::string attrModelPath = "./models/far103_224y.img"; std::string featureModelPath = "./models/fr_feature_am.img"; std::string cosModelPath = "./models/fr_cos256.img"; std::string qualityModelPath = "./models/fr_angle_y66.img"; std::string emoModelPath = "./models/far101_224y_emo.img"; memcpy(initParam.ipu_firmware_path, bin.c_str(), bin.length()+1); memcpy(initParam.det_model_path, detModelPath.c_str(), detModelPath.length()+1); memcpy(initParam.attr_model_path, attrModelPath.c_str(), attrModelPath.length()+1); memcpy(initParam.feature_model_path, featureModelPath.c_str(), featureModelPath.length()+1); memcpy(initParam.cos_model_path, cosModelPath.c_str(), cosModelPath.length() + 1); memcpy(initParam.quality_model_path, qualityModelPath.c_str(), qualityModelPath.length() + 1); memcpy(initParam.emo_model_path, emoModelPath.c_str(), emoModelPath.length() + 1); initParam.create_device = true; initParam.destroy_device = true; initParam.fr_mode = FR_MODE_FACE_RECOG | FR_MODE_FACE_DET | FR_MODE_FACE_QUALITY; ret = ALGO_FR_InitHandle(handle, &initParam); }
3.3. ALGO_FR_GetInputAttr¶
-
Function
Retrieve the attribute information of the face detection model, facial attribute model, and face quality model, including the input resolution and data type requirements for each model.
-
Syntax
MI_S32 ALGO_FR_GetInputAttr(void *handle, FrInputAttr_t *det_input_attr, FrInputAttr_t *attr_input_attr, FrInputAttr_t *quality_input_attr);
-
Parameters
Parameter Name Description Input/Output handle handle Input det_input_attr pointer to the input attributes of the face detection model, see FrInputAttr_t for details Input attr_input_attr pointer to the input attributes of the face attribute model, see FrInputAttr_t for details Input quality_input_attr pointer to the input attributes of the face quality model, see FrInputAttr_t for details Input -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.4. ALGO_FR_SetParams¶
-
function
Set configurable parameters of the algorithm.
-
Syntax
MI_S32 ALGO_FR_SetParams(void *handle, const FrParams_t *params);
-
Parameters
Parameter Name Description Input/Output handle handle Input params algorithm parameters, seeFrParams_t for details Input -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.5. ALGO_FR_Detect¶
-
function
face detection.
-
Syntax
MI_S32 ALGO_FR_Detect(void *handle, const FrInput_t *algo_input, const FrDetectMode_e *detect_mode, FrBox_t bboxes[MAX_FR_OBJECT], MI_S32 *num_bboxes);
-
Parameters
Parameter Name Description Input/Output handle handle Input algo_input input image buffer, see FrInput_t for details Input detect_mode detection model, see FrDetectMode_e for details Input bboxes array to save face detection result boxes, see FrBox_t for details Output num_bboxes pointer to number of detection result boxes Output -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.6. ALGO_FR_Align¶
-
function
face alignment.
-
Syntax
MI_S32 ALGO_FR_Align(void *handle, MI_U8* image_data, MI_S32 type, FrBox_t *detect_box, MI_U8* out_data);
-
Parameters
Parameter Name Description Input/Output handle algorithm handle Input image_data pointer to image data buffer, note: width/height of image should be consistent of disp_width/height of FrInit_t Input type image format type, yuv420_nv12=1,argb8888=0 Input detect_box face detection boxes of input image which need to be aligned, see FrBox_t for details Input out_data face area image data in 112x112 ARGB8888 format, should not be null Output -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.6.1 ALGO_FR_AlignRegist¶
-
Function
Used for the face alignment interface for registering faces.
-
Syntax
MI_S32 ALGO_FR_AlignRegist(void *handle, MI_U8* image_data, MI_S32 width, MI_S32 height, MI_S32 type, FrBox_t *detect_box, MI_U8* out_data);
-
Parameters
Parameter Name Description Input/Output handle Handle Input image_data Pointer to the original image data, the width and height of the image must equal the disp_width and disp_height set in the initialization parameters FrInit_t Input width Width of the original image data Input height Height of the original image data Input type Image type, yuv420_nv12 is 1, argb8888 is 0 Input detect_box Face detection box that needs to be aligned on the input image (coordinates of the box must be mapped to the original image's width and height), see FrBox_t Input out_data Output aligned 112x112 ARGB888 data, cannot be null Output Note: Coordinate transformation *width/disp_width,*height/disp_height
-
Return Value
Return Value Description 0 Success Other Failure (see Error Codes) -
Dependencies
Header file: sgs_fr_api.h
Library files: libsgsalgo_fr.so, libsgsalgo_fr.a
3.7. ALGO_FR_Attr¶
-
function
face attribute recognition.
-
Syntax
MI_S32 ALGO_FR_Attr(void *handle, const FrInput_t *algo_input, FrAttr_t *results);
-
Parameters
Parameter Name Description Input/Output handle algorithm handle Input algo_input pointer to image data buffer, see FrInput_t for details Input results face attribute recognition result, see FrAttr_t for details Output -
Description
face image data pass in this api must be expanded with a certain margin around the face area.The expansion margins should be set to 1.25 times the width (bbox_w) and height (bbox_h) of the original bounding box.
-
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.8. ALGO_FR_FaceQuality¶
-
function
Face angle estimation and quality filtering.
-
Syntax
MI_S32 ALGO_FR_FaceQuality(void *handle, const FrInput_t *algo_input, FrBox_t *detect_box, FaceQualityAngle_t *angle);
-
Parameters
Parameter Name Description Input/Output handle handle Input algo_input pointer to image data buffer, see FrInput_tfor details Input detect_box pointer to face detection output box, see FrBox_t for details Input/Output angle face angle estimation result, see FaceQualityAngle_t for details Output -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.9. ALGO_FR_FeatureExtract¶
-
function
face feature extraction.
-
Syntax
MI_S32 ALGO_FR_FeatureExtract(void *handle, MI_U8* image_data, MI_S16* out_feature);
-
Parameters
Parameter Name Description Input/Output handle handle Input image_data 112*112 image data output by ALGO_FR_Align Input out_feature face feature data, which is a 512-dimensional MI_S16 vector Output -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.10. ALGO_FR_FeatureCompare¶
-
function
feature comparison.
-
Syntax
MI_S32 ALGO_FR_FeatureCompare(MI_S16* feature1, MI_S16* feature2, MI_S32 length, MI_FLOAT* similarity);
-
Parameters
Parameter Name Description Input/Output feature1 feature of first face Input feature2 feature of second face Input length feature length, equals to 512 in this version Input similarity similarity of two faces Output -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.11. ALGO_FR_BatchFeatureCompare¶
-
function
batch face feature comparison(need to make one feature copy) .
-
Syntax
MI_S32 ALGO_FR_BatchFeatureCompare(void *handle, MI_S16* single_feature, MI_S16* batch_features, MI_S32 batch, MI_FLOAT* similarity);
-
Parameters
Parameter Name Description Input/Output handle handle Input single_feature destination feature(1) Input batch_features source features(batch) Input batch number of source features Input similarity output feature comparison similarity Output -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.12. ALGO_FR_BatchFeatureCompareV2¶
-
function
batch face feature comparison(no need to make feature copy) .
-
Syntax
MI_S32 ALGO_FR_BatchFeatureCompareV2(void *handle, const FrInput_t *single_feature, const FrInput_t *batch_features, MI_S32 batch, MI_FLOAT* similarity);
-
Parameters
Parameter Name Description Input/Output handle handle Input single_feature source feature(1), pass in as MMA buffer Input batch_features destination features(batch), pass in as MMA buffer Input batch number of source features Input similarity output feature comparison similarity Output -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.13. ALGO_FR_DeinitHandle¶
-
Function
stop algorithm and de-initialize handle.
-
Syntax
MI_S32 ALGO_FR_DeinitHandle(void *handle);
-
Parameters
Parameter Name Description Input/Output handle handle Input -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.14. ALGO_FR_ReleaseHandle¶
-
function
Release Algorithm Handle
-
Syntax
MI_S32 ALGO_FR_ReleaseHandle(void *handle);
-
Parameters
Parameter Name Description Input/Output handle handle Input -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
3.15. ALGO_FR_FaceBlur¶
-
function
get face blur score
-
Syntax
MI_S32 ALGO_FR_FaceBlur(void *handle, const MI_U8* image_data, MI_FLOAT *blur_score);
-
Parameters
Parameter Name Description Input/Output handle handle Input image_data 112*112 image data output by ALGO_FR_Align Input blur_score output pointer to blur score, which is a float range from 0.0 to 100.0, lower score means blurrier face Output -
Return Value
Return Value Description 0 Success Others Failure(seeError Code for details) -
Dependencies
header files:sgs_fr_api.h
library files:libsgsalgo_fr.so, libsgsalgo_fr.a
4. Data Type¶
| Data Type | Definition |
|---|---|
| FrMode_e | algorithm mode |
| FrInit_t | initialization algorithm parameters |
| FrInputAttr_t | algorithm input attributes structure |
| FrParams_t | configurable parameters of the algorithm |
| FrInput_t | model input attributes structure |
| FrDetectMode_e | face detection mode |
| FrPoint_t | face key-point coordinates structure |
| FrBox_t | face detection box structure |
| FrAttr_t | face attribute structure |
| FaceQualityAngle_t | face angle structure |
4.1. FrMode_e¶
-
Description
Algorithm mode.
-
Definition
typedef enum{ FR_MODE_FACE_DET=0x01, FR_MODE_FACE_RECOG=0x02, FR_MODE_FACE_ATTR=0x04, FR_MODE_FACE_EMOTION=0x08, FR_MODE_FACE_QUALITY=0x10, FR_MODE_FACE_BLUR=0x20, }FrMode_e; -
Members
Member Name Description FR_MODE_FACE_DET face detection FR_MODE_FACE_RECOG face recognition FR_MODE_FACE_ATTR facial attribute recognition FR_MODE_FACE_EMOTION face emotion recognition FR_MODE_FACE_QUALITY face angle estimation and quality filtering FR_MODE_FACE_BLUR face blur estimation -
Related Data Type and APIs
4.2. FrInit_t¶
-
Description
Algo initialization parameters
-
Definition
typedef struct { char ipu_firmware_path[MAX_FR_STRLEN]; // ipu_firmware.bin path char det_model_path[MAX_FR_STRLEN]; // detect model path, set when chose FR_MODE_FACE_DET mode char feature_model_path[MAX_FR_STRLEN]; // feature extraction model path, set when chose FR_MODE_FACE_RECOG mode char cos_model_path[MAX_FR_STRLEN]; // feature comparison model path, set when chose FR_MODE_FACE_RECOG mode char attr_model_path[MAX_FR_STRLEN]; // face attr model path, set when chose FR_MODE_FACE_ATTR mode char emo_model_path[MAX_FR_STRLEN]; // face emotion model path, set when chose FR_MODE_FACE_EMOTION mode char quality_model_path[MAX_FR_STRLEN]; // face angle model path, set when chose FR_MODE_FACE_QUALITY mode MI_BOOL create_device; // set false to create ipu device outside algo lib MI_BOOL destroy_device; // set false to destroy ipu device outside algo lib MI_U8 fr_mode; char blur_model_path[MAX_FR_STRLEN]; // face blur model path, set when choose } FrInit_t; -
Members
Member Name Description ipu_firmware_path file path of ipu firmware det_model_path path of detection model feature_model_path path of feature extraction model cos_model_path path of similarity model attr_model_path path of face attribute recognition model emo_model_path path of face emotion recognition model quality_model_path path of face quality estimation model create_device Whether to create the IPUDevice inside the algorithm library. Default is true (created internally). Set to false if the algorithm library is called concurrently, and manually create the IPUDevice externally destroy_device Whether to destroy the IPUDevice inside the algorithm library. Default is true (destroyed internally). Set to false if the algorithm library is called concurrently, and manually destroy the IPUDevice externally fr_mode algorithm mode, default is face recognition mode blur_model_path path of face blur estimation model -
Related APis
4.3 FrInputAttr_t¶
-
Description
model input attribute structure
-
Definition
typedef struct { MI_U32 width; MI_U32 height; MI_IPU_ELEMENT_FORMAT format; } FrInputAttr_t; -
Members
Member Name Description width width of model input height height of model input format pixel format of model input -
Related Data Type and APis
4.4. FrParams_t¶
-
Description
configurable parameters of the algorithm
-
Definition
typedef struct { MI_S32 disp_width; MI_S32 disp_height; // detect MI_FLOAT det_threshold; MI_S32 box_min_size; MI_FLOAT face_angle_ratio; MI_FLOAT eye_distance; // attr, emotion MI_FLOAT attr_threshold; // track MI_FLOAT motion_sensitive; // face quality MI_FLOAT face_quality_threshold; } FrParams_t; -
Members
Member Name Description disp_width Width of he video stream resolution (used for mapping detection box coordinates and as the original image size for face alignment). disp_height Height of he video stream resolution (used for mapping detection box coordinates and as the original image size for face alignment). det_threshold Minimum face detection score,range 0.0~1.0, recommended value: 0.5. Increasing the value reduces false positives but lowers recall; decreasing the value improves recall but increases false positives. box_min_size Minimum face detection box size ,recommended value is 20(pixel) face_angle_ratio Head rotation/pitch angle threshold, range 0.0~1.0. Higher values demand stricter frontal angles (recommended value: 0.25). eye_distance Minimum eye distances,recommended value is 20(pixel) attr_threshold Score threshold of face attribute recognition, face emotion recognition,range 0.0~1.0,recommended value is 0.5 motion_sensitive Face movement amplitude threshold,range 0.0~1.0,Higher values demand smaller face movement face_quality_threshold Face quality threshold,range 0.0~1.0,recommended value is 0.3 -
Related Data Type and APIs
4.5 FrInput_t¶
-
Description
model input attributes structure
-
Definition
typedef struct { void *p_vir_addr; MI_PHY phy_addr; MI_U32 buf_size; MI_U64 pts; } FrInput_t; -
Members
Member Name Description p_vir_addr virtual address of input buffer phy_addr physical address of input buffer buf_size length of input buffer pts timestamp of input buffer -
Related Data Type and APis
4.6. FrDetectMode_e¶
-
Description
face detection mode
-
Definition
typedef enum{ FR_DETECT_MODE_DET_MAX_FACE=0, FR_DETECT_MODE_DET_ALL_FACE, FR_DETECT_MODE_TRACK_MAX_FACE, FR_DETECT_MODE_TRACK_ALL_FACE, }FrDetectMode_e; -
Members
Member Name Description FR_DETECT_MODE_DET_MAX_FACE use maximum detected face FR_DETECT_MODE_DET_ALL_FACE use all detected faces FR_DETECT_MODE_TRACK_MAX_FACE video input,use maximum detected face, add track id FR_DETECT_MODE_TRACK_ALL_FACE video input,use all detected faces, add track id -
Related Data Type and APIs
4.7. FrPoint_t¶
-
Description
face key-point coordinates structure
-
Definition
typedef struct FrPoint_ { MI_FLOAT x; MI_FLOAT y; }FrPoint_t; -
Members
Member Name Description x key-point horizontal coordinate y key-point vertical coordinate -
Related Data Type and APIs
4.8. FrBox_t¶
-
Description
face detection box structure
-
Definition
typedef struct FrBox_ { MI_FLOAT x1; MI_FLOAT y1; MI_FLOAT x2; MI_FLOAT y2; MI_FLOAT score; FrPoint_t landmark[FR_POINT_LEN]; MI_U64 face_id; // track id MI_BOOL befiltered; MI_FLOAT move_sensitive; // lower value means larger face movement }FrBox_t; -
Members
Member Name Description X1 x coordinate of face box left-top point Y1 y coordinate of face box left-top point X2 x coordinate of face box right-bottom point Y2 y coordinate of face box right-bottom point score face confidence landmark 5 face landmarks face_id face track id befiltered whether face is filtered, true means filtered move_sensitive face movement amplitude threshold,range 0.0~1.0,Higher values demand smaller face movement -
Related Data Type and APIs
4.9. FrAttr_t¶
-
Description
face attribute structure
-
Definition
typedef struct FrAttr_t_ { MI_BOOL eye_glass; MI_BOOL male; MI_BOOL mask; MI_S32 age; MI_BOOL mustache; MI_S32 emotion; }FrAttr_t; -
Members
Member Name Description eye_glass wear glasses or not male male or not mask wear mask or not age age mustache have a mustache or not emotion emotion type, corresponding relationships are as follows: 0: Neutral; 1: Happy;2: Sad; 3: Surprised;4: Fearful;5: Disgusted;6: Angry -
Related Data Type and APIs
4.10. FaceQualityAngle_t¶
-
Description
Face angle estimation output structure
-
Definition
typedef struct FaceQualityAngle_ { MI_FLOAT pitch; MI_FLOAT yaw; MI_FLOAT roll; MI_FLOAT quality; }FaceQualityAngle_t; -
Members
Member Name Description pitch face pitch angle yaw face yaw angle roll face roll angle quality face angle Composite Score -
Related Data Type and APIs
5. Error Code¶
| Error Code | Value | Description |
|---|---|---|
| E_ALGO_SUCCESS | 0 | Operation successful |
| E_ALGO_HANDLE_NULL | 1 | Algorithm handle is null |
| E_ALGO_INVALID_PARAM | 2 | Invalid input parameter |
| E_ALGO_DEVICE_FAULT | 3 | Hardware error |
| E_ALGO_LOADMODEL_FAIL | 4 | Model loading failed |
| E_ALGO_INIT_FAIL | 5 | Algorithm initialization failed |
| E_ALGO_NOT_INIT | 6 | Algorithm has not been initialized |
| E_ALGO_INPUT_DATA_NULL | 7 | Algorithm input data is null |
| E_ALGO_INVALID_INPUT_SIZE | 8 | Invalid dimensions of the algorithm input data |
| E_ALGO_INVALID_LICENSE | 9 | Invalid license permission |
| E_ALGO_MEMORY_OUT | 10 | Insufficient memory |
| E_ALGO_FILEIO_ERROR | 11 | File read/write operation error |
| E_ALGO_INVALID_OUTPUT_SIZE | 12 | Invalid dimensions of the algorithm output data |
| E_ALGO_INVALID_DECODE_MODE | 13 | Invalid decode mode |
| E_ALGO_MODEL_INVOKE_ERROR | 14 | Model invoke error |
| E_ALGO_INVALID_FILE | 15 | Invalid file |