API Reference

init_sdk

def init_sdk(key_path: str) -> int:

Name

init_sdk

Description

Initializes the SDK.

Input

  • key_path (str): Path to the license key file

Output

Status code indicating the result of the initialization.

  • 0: Success

  • Non-zero: Initialization failed

get_attribute

def get_attribute(image: np.ndarray, width: int, height: int, face_bbox: np.ndarray, attribute: np.ndarray, angles: np.ndarray, liveness: np.ndarray, age: np.ndarray, gender: np.ndarray, mask: np.ndarray, template: np.ndarray, template_len: np.ndarray, mode: int) -> int:

Name

get_attribute

Description

Detects and analyzes face.

Input

  • image (numpy.ndarray): Input image matrix

  • width (int): Width of the input image

  • height (int): Height of the input image

  • face_bbox (numpy.ndarray): Face bounding box coordinates. Extracted face bbox will be stored

  • attribute (numpy.ndarray): Wear_glass, Eye_open and Mouth_Close detections of detected face

Wear_glass: 0 -> No, 1 -> Yes

Eye_open: 0 -> Close, 1 -> Open

Mouth_Close: 0 -> Close, 1 -> Open

  • angles (numpy.ndarray): Pitch, Yaw, Roll degree of detected face

  • liveness (numpy.ndarray): Liveness score of detected face

0 -> SPOOF

1 -> REAL

-3 -> TOO SMALL FACE

-4 -> TOO LARGE FACE

-102 -> NO FACE

-103 -> LIVENESS CHECK FAILED

  • age (numpy.ndarray): Estimated age of the detected face

  • gender (numpy.ndarray): Gender prediction of the detected face

0 -> Male, 1 -> Female

  • mask (numpy.ndarray): Mask detection of the detected face

0 -> No, 1 -> Yes

  • template (numpy.ndarray): Template buffer. Extracted template will be stored

  • template_len (numpy.ndarray): Length of the extracted template

  • mode (int): 0-> Enroll mode, 1-> Identify mode

Output

Status code indicating the result of getting attribute.

  • 0: Success

  • -1: SDK Initialization Error

  • -2: No Face

calculate_similarity

def calculate_similarity(feature_1: np.ndarray, feature_1_len: int, feature_2: np.ndarray, feature_2_len: int) -> float:

Name

calculate_similarity

Description

Calculates the similarity between two features

Input

  • feature_1 (numpy.ndarray): 1st feature

  • feature_1_len (int): Length of the 1st feature

  • feature_2 (numpy.ndarray): 2nd feature

  • feature_2_len (int): Length of the 2nd feature

Output

Similarity score between the two features

The score ranges from 0.0 to 1.0 Default Threshold is 0.82

Last updated