Face Factor

Factor implements the functionalities of each factors to generate and verify Private IDs .

This section covers how to use the Biometric 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:

  • Name
    api_key
    Type
    str
    Description

    The API key for using the FaceFactor server.

  • Name
    server_url
    Type
    str
    Description

    The URL of the FaceFactor server.

  • Name
    local_storage_path
    Type
    str(optional)
    Description

    Absolute path to the local storage.

  • Name
    logging_level
    Type
    LoggingLevel (Optional)
    Description

    LoggingLevel needed while performing operation

  • Name
    tf_num_thread
    Type
    int (Optional)
    Description

    Number of thread to use for Tensorflow model inference

  • Name
    cache_type
    Type
    CacheType (Optional)
    Description

    To set the cache on / off

  • Name
    config
    Type
    ConfigObject (Optional)
    Description

    Configuration class object with parameters

Methods

Method Description
is_valid([image_path, image_data, config]) Check if the image is valid for using in the face recognition
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:

  • Name
    FaceFactor
    Description

    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

  • Name
    image_path_1
    Description

    Directory path to the first image file

  • Name
    image_path_2
    Description

    Directory path to the second image file

  • Name
    config
    Type
    Optional
    Description

    Additional configuration parameters for the operation

  • Name
    image_data_1
    Type
    Optional
    Description

    First Image data in numpy RGB format

  • Name
    image_data_2
    Type
    Optional
    Description

    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

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

Parameters

  • Name
    image_path
    Description

    Directory path to the first image file

  • Name
    config
    Type
    Optional
    Description

    Additional configuration parameters for the operation

  • Name
    image_data
    Type
    Optional
    Description

    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

  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

  • Name
    image_path
    Description

    Directory path to the first image file

  • Name
    config
    Type
    Optional
    Description

    Additional configuration parameters for the operation

  • Name
    image_data
    Type
    Optional
    Description

    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]

Face ISO

  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

  • Name
    image_path
    Description

    Directory path to the first image file

  • Name
    config
    Type
    Optional
    Description

    Additional configuration parameters for the operation

  • Name
    image_data
    Type
    Optional
    Description

    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

  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

  • Name
    image_path
    Description

    Directory path to the first image file

  • Name
    config
    Type
    Optional
    Description

    Additional configuration parameters for the operation

  • Name
    image_data
    Type
    Optional
    Description

    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

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

Predicts the image in the face recognition server

Parameters

  • Name
    image_path
    Description

    Directory path to the first image file

  • Name
    config
    Type
    Optional
    Description

    Additional configuration parameters for the operation

  • Name
    image_data
    Type
    Optional
    Description

    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

Was this page helpful?