API Reference

get_version

def get_version() -> str:

Name

get_version

Description

Retrieves the SDK version information from a library.

Input

None

Output

The version string is returned as a standard Python string.

get_device_id

def get_device_id() -> str:

Name

get_device_id

Description

Retrieves the Hardware ID from a library.

Input

None

Output

The Hardware ID is returned as a standard Python string.

init_sdk

def init_sdk(dict_path: str, online_key: str) -> int:

Name

init_sdk

Description

Initializes the SDK in online mode.

Input

  • dict_path (str): Path to the engine binary files directory

  • online_key (str): Online key string

Output

Status code indicating the result of the initialization.

  • 0: Success

  • Non-zero: Initialization failed

init_sdk_offline

def init_sdk_offline(dict_path: str, offline_key_path: str) -> int:

Name

init_sdk_offline

Description

Initializes the SDK in offline mode.

Input

  • dict_path (str): Path to the engine binary files directory

  • offline_key (str): Path to the offline license key file

Output

Status code indicating the result of the initialization.

  • 0: Success

  • Non-zero: Initialization failed

extract_template

def extract_template(image: np.ndarray, width: int, height: int, face_bbox: np.ndarray, template: np.ndarray, template_len: np.ndarray) -> int:

Name

extract_template

Description

Extracts a template from an image

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

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

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

Output

Status code indicating the result of the template extraction.

  • >0: Success

  • 0: No Face

  • -1: SDK Activation Error

  • -2: SDK Initialization Error

calculate_similarity

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

Name

calculate_similarity

Description

Calculates the similarity between two features

Input

  • feature_1 (numpy.ndarray): 1st feature

  • feature_2 (numpy.ndarray): 2nd feature

Output

Similarity score between the two features

The score ranges from 0.0 to 1.0 Default Threshold is 0.67

Last updated