Face Factor

This section covers how to use the Face Factor for generating and verifying Private IDs.

class cryptonets_python_sdk.factor.FaceFactor(*args, **kwargs)

The FaceFactor class implements the methods for enrolling and predicting the Face module as part of the Biometric Authentication.

It exposes five methods as part of the interface:

  1. is_valid: Verifies the face of the user.

  2. estimate_age: Predicts the age of the face.

  3. compare: Compare two faces for verification.

  4. enroll: Enrolls the face of the user.

  5. predict: Predicts the face of the user.

  6. delete: Deletes the user from the system

Parameters:
api_keystr

The API key for using the FaceFactor server.

server_urlstr

The URL of the FaceFactor server.

local_storage_pathstr (optional)

Absolute path to the local storage.

logging_levelLoggingLevel (Optional)

LoggingLevel needed while performing operation

tf_num_thread: int (Optional)

Number of thread to use for Tensorflow model inference

cache_type: CacheType (Optional)

To set the cache on / off

configConfigObject (Optional)

Configuration class object with parameters

Methods

is_valid([image_path, image_data, config])

Check if the image is valid for using in the face recognition

estimate_age([image_path, image_data, config])

Check if the image is valid and returns the age of the image

compare([image_path_1, image_path_2, ...])

Check if the images are of same person or not

enroll([image_path, image_data, config])

Enrolls the image in the face recognition server

predict([image_path, image_data, config])

Predicts the image in the face recognition server

get_iso_face([image_path, image_data, config])

Takes the face image and gives back the image in ISO Spec format

delete

Returns:
FaceFactor

Instance of the FaceFactor class.

compare(image_path_1: str = None, image_path_2: str = None, image_data_1: array = None, image_data_2: array = None, config: ConfigObject = None) FaceCompareResult

Check if the images are of same person or not

Parameters:
image_path_1

Directory path to the first image file

image_path_2

Directory path to the second image file

config (Optional)

Additional configuration parameters for the operation

image_data_1 (Optional)

First Image data in numpy RGB format

image_data_2 (Optional)

Second Image data in numpy RGB format

Returns:
FaceCompareResult

status: int [0 if same, 1 if different, -1 if unsuccessful]

message: str [Message from the operation]

result: str

distance_min: str

distance_mean: str

distance_max: str

first_validation_result: str

second_validation_result: str

enroll(image_path: str = None, image_data: array = None, config: ConfigObject = None) FaceEnrollPredictResult

Enrolls the image in the face recognition server

Parameters:
image_path

Directory path to the image file

config (Optional)

Additional configuration parameters for the operation

image_data (Optional)

Image data in numpy RGB format

Returns:
FaceEnrollPredictResult

status: int [0 if successful -1 if unsuccessful]

message: str [Message from the operation]

enroll_level: str

guid: str

puid: str

token: str

estimate_age(image_path: str = None, image_data: array = None, config: ConfigObject = None) FaceValidationResult

Check if the image is valid and returns the age of the image

Parameters:
image_path

Directory path to the image file

config (Optional)

Additional configuration parameters for the operation

image_data (Optional)

Image data in numpy RGB format

Returns:
FaceValidationResult

error: int [0 if successful -1 if any error]

message: str [Message from the operation]

face_objects: List[FaceObjectResult]

get_iso_face(image_path: str = None, image_data: array = None, config: ConfigObject = None) ISOFaceResult

Takes the face image and gives back the image in ISO Spec format

Parameters:
image_path

Directory path to the image file

config (Optional)

Additional configuration parameters for the operation

image_data (Optional)

Image data in numpy RGB format

Returns:
ISOFaceResult

status: int [0 if successful -1 if unsuccessful]

message: str [Message from the operation]

image: PIL.Image

confidence: float

iso_image_width: str

iso_image_height: str

iso_image_channels: str

is_valid(image_path: str = None, image_data: array = None, config: ConfigObject = None) FaceValidationResult

Check if the image is valid for using in the face recognition

Parameters:
image_path

Directory path to the image file

config (Optional)

Additional configuration parameters for the operation

image_data (Optional)

Image data in numpy RGB format

Returns:
FaceValidationResult

error: int [0 if successful -1 if any error]

message: str [Message from the operation]

face_objects: List[FaceObjectResult]

predict(image_path: str = None, image_data: array = None, config: ConfigObject = None) FaceEnrollPredictResult | List[FaceEnrollPredictResult]

Predicts the image in the face recognition server

Parameters:
image_path

Directory path to the image file

config (Optional)

Additional configuration parameters for the operation

image_data (Optional)

Image data in numpy RGB format

Returns:
FaceEnrollPredictResult

status: int [0 if successful -1 if unsuccessful]

message: str [Message from the operation]

enroll_level: str

guid: str

puid: str

token: str