Face 1:1 Comparison and 1:N Search

Windows/Linux/Arm_Linux interface is described here, for Android interface please refer to Android Interface Description.

Face feature comparison interface

stid_facepro_feature_comparison_create_handle

Function: Create a handle by loading a specified model file.

Declaration:

STID_SDK_API
stid_result_t
stid_facepro_feature_comparison_create_handle(
    stid_handle_t* out_handle,
    const char *model_filename
);

Parameters:

  • [in] model_filename: Pass the location of the model file.

  • [out] out_handle: Return the initialized handle, when not in use, call stid_face_feature_destroy_handle to release resource.

Return:

  • [return] Return STID_OK if successful, otherwise return error code.

stid_facepro_feature_comparison_destroy_handle

Function: Release handle.

Declaration:

STID_SDK_API
void
stid_facepro_feature_comparison_destroy_handle(
    stid_handle_t handle
);

Parameters:

  • [in] handle: Handle to be released.

Return: None.

stid_facepro_feature_comparison_compare

Function: Compare two face features to obtain similarity, 1:1 interface.

Declaration:

STID_SDK_API
stid_result_t
stid_facepro_feature_comparison_compare(
    stid_handle_t handle,
    const char *feature1,
    const char *feature2,
    float *out_score
);

Parameters:

  • [in] handle: Initialized handle.

  • [in] feature1: First face feature information.

  • [in] feature2: Second face feature information.

  • [out] out_score: Return similarity score, a larger score corresponding to a higher similarity.

Return:

  • [return] Return STID_OK if successful, otherwise return error code.

stid_facepro_feature_comparison_search_from_list

Function: Search faces from a group of feature arrays, 1:N interface.

Declaration:

STID_SDK_API
stid_result_t
stid_facepro_feature_comparison_search_from_list(
    stid_handle_t handle,
    char *const *feature_list,
    int list_size,
    const char *query,
    unsigned int top_k,
    int *top_idxs,
    float *top_scores,
    int *result_length
);

Parameters:

  • [in] handle: Initialized handle.

  • [in] feature_list: Face feature information array.

  • [in] list_size: Size of face feature information.

  • [in] query Face: Feature information to be queried.

  • [in] top_k: Maximum number of face queries.

  • [out] top_idxs: Array of face database indexes queried by top_idxs (allocated and released by user)

  • [out] top_scores: Array of face similarity scores (allocated and released by user), ranging from 0-1. Scores closer to 1 indicate larger similarities.

  • [out] result_length: Number of faces found.

Return:

  • [return] Return ST_OK if successful, otherwise return error type.

Last updated