Face Detection and Recognition

SDK.detect_faces(self: tfsdk.SDK) → List[Trueface::FaceBoxAndLandmarks]

Detect all the faces in the image and return the bounding boxes and facial landmarks. This method has a small false positive rate. To reduce the false positive rate to near zero, filter out faces with score lower than 0.90.

The recall and precision of the face detection algorithm on the WIDER FACE dataset:

_images/face_detection_roc.png

The effect of face height on similarity score:

_images/face_height_match_score_FULL_model.png _images/face_height_match_score_LITE_model.png
SDK.detect_largest_face(self: tfsdk.SDK) → Tuple[bool, Trueface::FaceBoxAndLandmarks]

Detect all the largest face in the image.

SDK.get_face_landmarks(self: tfsdk.SDK, face_box_and_landmarks: Trueface::FaceBoxAndLandmarks) → Tuple[Trueface::ErrorCode, List[Trueface::Point<int>]]

Obtain the 106 face landmarks.

The order of the face landmarks:

_images/landmarks.png
SDK.extract_aligned_face(self: tfsdk.SDK, face_box_and_landmarks: Trueface::FaceBoxAndLandmarks, margin_left: int = 0, margin_top: int = 0, margin_right: int = 0, margin_bottom: int = 0, scale: float = 1.0) → numpy.ndarray[uint8]

Extract the aligned face in Numpy array of 112x112 pixels.

SDK.save_face_image(self: tfsdk.SDK, face_image: numpy.ndarray[uint8], filepath: str) → None

Store the face image in JPEG file.

SDK.get_face_feature_vector(*args, **kwargs)

Overloaded function.

  1. get_face_feature_vector(self: tfsdk.SDK, aligned_face_image: numpy.ndarray[uint8]) -> Tuple[Trueface::ErrorCode, Trueface::Faceprint]

Return the corresponding feature vector for the given aligned face image.

  1. get_face_feature_vector(self: tfsdk.SDK, face_box_and_landmarks: Trueface::FaceBoxAndLandmarks) -> Tuple[Trueface::ErrorCode, Trueface::Faceprint]

Extract the face feature vector from the face box.

SDK.get_face_feature_vectors(self: tfsdk.SDK, aligned_face_images: List[numpy.ndarray[uint8]]) → Tuple[Trueface::ErrorCode, List[Trueface::Faceprint]]

Extract the face feature vectors from the aligned face images.This batch processing method increases throughput on platforms such as cuda.

SDK.get_largest_face_feature_vector(self: tfsdk.SDK) → Tuple[Trueface::ErrorCode, Trueface::Faceprint]

Detect the largest face in the image and return the corresponding feature vector.

SDK.get_similarity(self: tfsdk.SDK, feature_vector_1: Trueface::Faceprint, feature_vector_2: Trueface::Faceprint) → Tuple[Trueface::ErrorCode, float, float]

Compute the similarity of the given feature vectors. Return match probability and similarity score (in that order)

SDK.estimate_face_image_quality(self: tfsdk.SDK, aligned_face_image: numpy.ndarray[uint8]) → Tuple[Trueface::ErrorCode, float]

Estimate the image quality for face recognition.

SDK.estimate_head_orientation(self: tfsdk.SDK, face_box_and_landmarks: Trueface::FaceBoxAndLandmarks) → Tuple[Trueface::ErrorCode, float, float, float]

Estimate the head orientation using the detected facial landmarks. Returns yaw, pitch, roll (in that order) in radians

The accuracy of this method is estimated using 1920x1080 pixel test images. A test image:

_images/yaw_positive_20.jpg

The accuracy of the head orientation estimation:

_images/yaw_estimation_accuracy.png

The effect of the face yaw angle on match similarity can be seen in the following figures:

_images/yaw_angle_match_score.png _images/yaw_angle_match_score.gif

The effect of the face pitch angle on match similarity can be seen in the following figures:

_images/pitch_angle_match_score.png _images/pitch_angle_match_score.gif
class tfsdk.FaceBoxAndLandmarks
property bottom_right

The bottom-right corner Point of the bounding box.

property landmarks

The list of facial landmark points (Point) in this order: left eye, right eye, nose, left mouth corner, right mouth corner.

property score

Likelihood of this being a true positive; a value lower than 0.85 indicates a high chance of being a false positive.

property top_left

The top-left corner Point of the bounding box.

class tfsdk.Faceprint
property feature_vector

Vector of floats which describe the face.

get_quantized_vector(self: tfsdk.Faceprint) → numpy.ndarray[int16]

Return the feature vector as a list of 16-bit integers

property model_name

Name of model used to generate feature vector.

property model_options

Additional options used for generating the feature vector.

property sdk_version

SDK version used to generate feature vector.

set_quantized_vector(self: tfsdk.Faceprint, arg0: numpy.ndarray[int16]) → None

Set the feature vector as a list of 16-bit integers

class tfsdk.Point
property x

Coordinate along the horizontal axis, or pixel column.

property y

Coordinate along the vertical axis, or pixel row.