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 following methods :
is_valid: Verifies the face of the user.
estimate_age: Predicts the age of the face.
compare: Compare two faces for verification.
enroll: Enrolls the face of the user.
predict: Predicts the face of the user.
delete: Deletes the user from the system
antispoof_check: Check if the image is spoofed or not
get_iso_face: Takes the face image and gives back the image in ISO Spec format
compare_doc_with_face: Check if the images are of same person or not
- Parameters:
- api_keystr
The API key for using the FaceFactor server.
- server_urlstr
The URL of the FaceFactor server.
- logging_levelLoggingLevel (Optional)
LoggingLevel needed while performing operation
- 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
delete
(puid[, config_object])Deletes a user by their PUID from the system
antispoof_check
([image_path, image_data, config])Check if the image is spoofed or not
get_iso_face
([image_path, image_data, config])Takes the face image and gives back the image in ISO Spec format
compare_doc_with_face
([face_path, doc_path, ...])Check if the images are of same person or not
- Returns:
- FaceFactor
Instance of the FaceFactor class.
- compare(image_path_1: str | None = None, image_path_2: str | None = None, image_data_1: array | None = None, image_data_2: array | None = None, config: ConfigObject | None = 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 call successful -1 if unsuccessful]
message: str [Message from the operation]
result: int [1 if same, -1 if different]
distance: float [comparaison distance]
first_validation_result: int
second_validation_result: int
- delete(puid: str, config_object: ConfigObject | None = None) FaceDeleteResult ¶
Deletes a user by their PUID from the system
- Parameters:
- puidstr
The PUID (Private User ID) of the user to delete
- config_objectConfigObject (Optional)
Additional configuration parameters for the operation
- Returns:
- FaceDeleteResult
Result of the delete operation
- enroll(image_path: str | None = None, image_data: array | None = None, config: ConfigObject | None = 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
- estimate_age(image_path: str | None = None, image_data: array | None = None, config: ConfigObject | None = None) AgeEstimateResult ¶
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:
- AgeEstimateResult
- operation_status_code: ApiReturnStatus [ApiReturnStatus.API_NO_ERROR (0) if successful, failure otherwise].
if failure, face_age_objects list will be None. The operation is considered successful if no face were detected in the image. In his case face_age_objects will be an empty list.
operation_message: str [Message explaining the error if any] face_age_objects: List[FaceAgeObjectResult]
- get_iso_face(image_path: str | None = None, image_data: array | None = None, config: ConfigObject | None = 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 = None, image_data: array | None = None, config: ConfigObject | None = 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 = None, image_data: array | None = None, config: ConfigObject | None = 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