General

Before you can call the SDK functions, you must first initialize the SDK with your desired configuration options. These configuration options will ultimately impact the behaviour of the SDK, so be sure to read through what each one does carefully.

Once you have initialized the SDK, then proceed to the the License section.

SDK.__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: tfsdk.SDK) -> None

Initialize the SDK using default configuration options.

  1. __init__(self: tfsdk.SDK, configuration_options: tfsdk.ConfigurationOptions) -> None

    Initialize the SDK using custom configuration options.

    Parameters

    configuration_options - custom configuration options.

static SDK.get_version()str

Gets the version-build number of the SDK.

Returns

The SDK version.

class tfsdk.FACIALRECOGNITIONMODEL

Facial recognition models. To compare model performances, refer to our ROC curves. You can also find more information on our FAQ page. The current most accurate model is TFV5.

Members:

LITE : Our most lightweight model with fastest inference time but lowest accuracy, ideal for embedded systems or lightweight CPU only deployments, prototyping, and some 1 to 1 matching use cases.

LITE_V2 : Lightweight model which has improved accuracy over the previous LITE model, though does have slightly larger inference time. Ideal for embedded systems or lightweight CPU only deployments, prototyping, and some 1 to 1 matching use cases.

FULL : Full TFV4 model which has better accuracy than the LITE model, but also has greater inference time. Ideal for GPU deployments and for 1 to N use cases. Note, TFV4 has now been deprecated and replaced by TFV5 which has better performance. Despite this, we will continue providing support for TFV4 for clients with existing collections.

TFV5 : TFV5 is currently the highest accuracy model. Ideal for GPU deployments and for 1 to N use cases.

class tfsdk.OBJECTDETECTIONMODEL

Object detection models

Members:

ACCURATE

FAST

class tfsdk.FACEDETECTIONFILTER

Filters the detected faces based on score thresholds obtained from ROC curve.

Members:

HIGH_RECALL : Filter the detected faces based on a low score threshold. Limits false negatives (does not detect a face), but may have more false positives (classifies a non-face as a face).

HIGH_PRECISION : Filter the detected faces based on a high score threshold. Limits false positives (classifies a non-face as a face), but may have more false negatives (does not detect a face).

BALANCED : Filter the detected faces based on a medium score threshold to balance false positives and false negatives. We advise using this option most of the time.

UNFILTERED : Do not filter the detected faces by score. Will have a large number of false positives (classifies a non-face as a face).

class tfsdk.DATABASEMANAGEMENTSYSTEM

Database Management System for storing Faceprints

Members:

SQLITE : Use sqlite backend. Write Faceprints to local disk. Ideal for embedded systems or use cases where only one process connects to the database.

POSTGRESQL : Use PostgreSQL backend. Ideal for distributed systems requiring synchronization.

NONE : Do not write Faceprints to disk, only store in ram. Warning, enrolled Faceprints will not be saved after the program terminates. Switching to a new collections will also delete all enrolled templates.

class tfsdk.EnableGPU

Enable GPU support (default is False). Note, GPU support requires a different version of the SDK. You are able to enable GPU for all modules or only specific modules.

property face_detector

Enable GPU inference for face detection

property face_recognizer

Enable GPU inference for face recognition template generation

EnableGPU.__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: tfsdk.EnableGPU) -> None

Default constructor initializes GPU inference for all modules to false

  1. __init__(self: tfsdk.EnableGPU, val: bool) -> None

    Enable or disable GPU inference for all modules.

    Parameters

    val - enable GPU for all modules.

class tfsdk.InitializeModule
property active_spoof

Active spoof

property bodypose_estimator

Bodypose estimator

property face_detector

Face detector

property face_recognizer

Face detector

property landmark_detector

Landmark detector

property liveness

Liveness

property object_detector

Object detector

class tfsdk.EncryptDatabase

Encrypt the biometric templates and identity strings when storing in the database using AES encryption. Note, enabling this option does add overhead to Faceprint enrollment as well as loading a collection from a database into memory. Enabling encryption does not increase the 1 to N identification time.

property enable_encryption

Enable database encryption. Must provide encryption key if encryption is enabled.If enabling encryption with PostgreSQL backend, it is strongly advised to require SSL for PostgreSQL connection.

property key

Encryption key. The key is hashed to a fixed length before being used for encryption.

class tfsdk.ConfigurationOptions
property GPU_device_index

GPU device index (default is 0)

property batch_sizes

Specify the batch sizes which will be used, resulting in improved performance when switching between batch sizes. If the batch sizes are specified, then using a non-specified batch size will result in an exception being thrown. Note, GPU memory will be allocated for each of the specified batch sizes, so specifying too many batch sizes may result in an out-of-memory crash. Leave vector empty to support dynamic batch sizes. Dynamic batch sizes will result in a slowdown when switching between batch sizes. Ex. If processing 36 images in the following batches: 10, 10, 10, 6 there will be a slight slowdown when switching from the batch size of 10 to 6.

property dbms

Database management system for storing Faceprints (default is SQLITE). See DATABASEMANAGEMENTSYSTEM

property enable_GPU

Enable GPU support (default is False). Note, GPU support requires a different version of the SDK. You are able to enable GPU for all modules or only specific modules. See EnableGPU

property encrypt_database

Encrypt the biometric templates and identity strings when storing in the database using AES encryption (default is disabled).

property fd_filter

The threshold level to use when filtering detected faces (default is BALANCED). See FACEDETECTIONFILTER

property fr_model

The model to be used for facial recognition (default is TFV5). See FACIALRECOGNITIONMODEL

property fr_vector_compression

Improves the computation speed for 1 to 1 comparisons and 1 to N searches. Also reduces the feature vector length (default is False).

property initialize_module

Initialize module in SDK constructor. By default, the SDK uses lazy initialization, meaning modules are only initialized when they are first used (on first inference). This is done so that modules which are not used do not load their models into memory, and hence do not utilize memory. The downside to this is that the first inference will be much slower as the model file is being decrypted and loaded into memory. Therefore, if you know you will use a module, choose to pre-initialize the module, which reads the model file into memory in the SDK constructor. See InitializeModule.

property models_path

The directory path containing the model files (default is ./ )

property obj_model

The model to be used for object detection (default is ACCURATE model). See OBJECTDETECTIONMODEL

property smallest_face_height

The smallest face height that the face detector can detect (default is 40 pixels). The face detector has a detection scale range of about 5 octaves. Ex. 40 pixels yields the detection scale range of ~40 pixels to 1280 (=40x2^5) pixels. If set to -1, will dynamically adjusts the face detection scale range from image-height/32 to image-height to ensure that large faces are detected in high resolution images. Increasing the tfsdk.ConfigurationOptions.smallest_face_height will result in faster face detection.

class tfsdk.ERRORCODE

Members:

NO_ERROR

EXTREME_FACE_ANGLE

INVALID_LICENSE

FILE_READ_FAIL

UNSUPPORTED_IMAGE_FORMAT

UNSUPPORTED_MODEL

NO_FACE_IN_FRAME

FACE_TOO_CLOSE

FACE_TOO_FAR

COLLECTION_CREATION_ERROR

DATABASE_CONNECTION_ERROR

ENROLLMENT_ERROR

FAILED

NO_RECORD_FOUND

NO_COLLECTION_FOUND

MAX_COLLECTION_SIZE_EXCEEDED

COLLECTION_DELETION_ERROR

Deprecated

The following have been deprecated and may be removed in future releases of the SDK.