Parameter Estimation Facility#
Overview#
The estimation facility is the only multi-purpose facility in FaceEngine. It is designed as a collection of tools that help to estimate various images or depicted object properties. These properties may be used to increase the precision of algorithms implemented by other FaceEngine facilities or to accomplish custom user tasks.
Best shot selection functionality#
Eyes Estimation#
Name: EyeEstimator
Algorithm description:
The estimator is trained to work with warped images (see chapter "Image warping" for details).
This estimator aims to determine:
- Eye state: Open, Closed, Occluded;
- Precise eye iris location as an array of landmarks;
- Precise eyelid location as an array of landmarks.
You can only pass warped image with detected face to the estimator interface. Better image quality leads to better results.
Eye state classifier supports three categories: "Open", "Closed", "Occluded". Poor quality images or ones that depict obscured eyes (think eyewear, hair, gestures) fall into the "Occluded" category. It is always a good idea to check eye state before using the segmentation result.
The precise location allows iris and eyelid segmentation. The estimator is capable of outputting iris and eyelid shapes as an array of points together forming an ellipsis. You should only use segmentation results if the state of that eye is "Open".
Implementation description:
The estimator:
-
Implements the estimate() function that accepts warped source image and warped landmarks, either of type Landmarks5 or Landmarks68. The warped image and landmarks are received from the warper (see
IWarper::warp()
); -
Classifies eyes state and detects its iris and eyelid landmarks;
-
Outputs EyesEstimation structures.
Orientation terms 'left' and 'right' refer to the way you see the image as it is shown on the screen. It means that left eye is not necessarily left from the person's point of view, but is on the left side of the screen. Consequently, right eye is the one on the right side of the screen. More formally, the label 'left' refers to subject's left eye (and similarly for the right eye), such that xright < xleft.
EyesEstimation::EyeAttributes
presents eye state as enum EyeState with possible values: Open, Closed, Occluded.
Iris landmarks are presented with a template structure Landmarks that is specialized for 32 points.
Eyelid landmarks are presented with a template structure Landmarks that is specialized for 6 points.
The EyesEstimation structure contains results of the estimation:
struct EyesEstimation {
/**
* @brief Eyes attribute structure.
* */
struct EyeAttributes {
/**
* @brief Enumeration of possible eye states.
* */
enum class State : uint8_t {
Closed, //!< Eye is closed.
Open, //!< Eye is open.
Occluded //!< Eye is blocked by something not transparent, or landmark passed to estimator doesn't point to an eye.
};
static constexpr uint64_t irisLandmarksCount = 32; //!< Iris landmarks amount.
static constexpr uint64_t eyelidLandmarksCount = 6; //!< Eyelid landmarks amount.
/// @brief alias for @see Landmarks template structure with irisLandmarksCount as param.
using IrisLandmarks = Landmarks<irisLandmarksCount>;
/// @brief alias for @see Landmarks template structure with eyelidLandmarksCount as param
using EyelidLandmarks = Landmarks<eyelidLandmarksCount>;
State state; //!< State of an eye.
IrisLandmarks iris; //!< Iris landmarks.
EyelidLandmarks eyelid; //!< Eyelid landmarks
};
EyeAttributes leftEye; //!< Left eye attributes
EyeAttributes rightEye; //!< Right eye attributes
};
API structure name:
IEyeEstimator
Plan files:
- eyes_estimation_flwr8_cpu.plan
- eyes_estimation_ir_cpu.plan
- eye_status_estimation_flwr_cpu.plan
- eyes_estimation_flwr8_cpu-avx2.plan
- eyes_estimation_ir_cpu-avx2.plan
- eyes_estimation_ir_gpu.plan
- eyes_estimation_flwr8_gpu.plan
- eye_status_estimation_flwr_cpu.plan
- eye_status_estimation_flwr_cpu-avx2.plan
- eye_status_estimation_flwr_gpu.plan
BestShotQuality Estimation#
Name: BestShotQualityEstimator
Algorithm description:
The BestShotQuality estimator is designed to evaluate image quality to choose the best image before descriptor extraction. The BestShotQuality estimator consists of two components - AGS (garbage score) and Head Pose.
AGS aims to determine the source image score for further descriptor extraction and matching.
Estimation output is a float score which is normalized in range [0..1]. The closer score to 1, the better matching result is received for the image.
When you have several images of a person, it is better to save the image with the highest AGS score.
Recommended threshold for AGS score is equal to 0.2. But it can be changed depending on the purpose of use. Consult VisionLabs about the recommended threshold value for this parameter.
Head Pose determines person head rotation angles in 3D space, namely pitch, yaw and roll.
Since 3D head translation is hard to determine reliably without camera-specific calibration, only 3D rotation component is estimated.
Head pose estimation characteristics:
- Units (degrees);
- Notation (Euler angles);
- Precision (see table below).
Implementation description:
The estimator (see IBestShotQualityEstimator in IEstimator.h):
-
Implements the estimate() function that needs
fsdk::Image
in R8G8B8 format,fsdk::Detection
structure of corresponding source image (see section "Detection structure" in chapter "Face detection facility"),fsdk::IBestShotQualityEstimator::EstimationRequest
structure andfsdk::IBestShotQualityEstimator::EstimationResult
to store estimation result; -
Implements the estimate() function that needs the span of
fsdk::Image
in R8G8B8 format, the span offsdk::Detection
structures of corresponding source images (see section "Detection structure" in chapter "Face detection facility"),fsdk::IBestShotQualityEstimator::EstimationRequest
structure and span offsdk::IBestShotQualityEstimator::EstimationResult
to store estimation results. -
Implements the estimateAsync() function that needs
fsdk::Image
in R8G8B8 format,fsdk::Detection
structure of corresponding source image (see section "Detection structure" in chapter "Face detection facility"),fsdk::IBestShotQualityEstimator::EstimationRequest
structure;
Note: Method estimateAsync() is experimental, and it's interface may be changed in the future. Note: Method estimateAsync() is not marked as noexcept and may throw an exception.
Before using this estimator, user is free to decide whether to estimate or not some listed attributes. For this purpose, estimate() method takes one of the estimation requests:
fsdk::IBestShotQualityEstimator::EstimationRequest::estimateAGS
to make only AGS estimation;fsdk::IBestShotQualityEstimator::EstimationRequest::estimateHeadPose
to make only Head Pose estimation;fsdk::IBestShotQualityEstimator::EstimationRequest::estimateAll
to make both AGS and Head Pose estimations;
The EstimationResult structure contains results of the estimation:
struct EstimationResult {
Optional<HeadPoseEstimation> headPose; //!< HeadPose estimation if was requested, empty otherwise
Optional<float> ags; //!< AGS estimation if was requested, empty otherwise
};
Head Pose accuracy:
Prediction precision decreases as a rotation angle increases. We present typical average errors for different angle ranges in the table below.
"Head pose prediction precision"
Range | -45°...+45° | < -45° or > +45° | |
---|---|---|---|
Average prediction error (per axis) | Yaw | ±2.7° | ±4.6° |
Average prediction error (per axis) | Pitch | ±3.0° | ±4.8° |
Average prediction error (per axis) | Roll | ±3.0° | ±4.6° |
Zero position corresponds to a face placed orthogonally to camera direction, with the axis of symmetry parallel to the vertical camera axis.
API structure name:
IBestShotQualityEstimator
Plan files:
- ags_angle_estimation_flwr_cpu.plan
- ags_angle_estimation_flwr_cpu-avx2.plan
- ags_angle_estimation_flwr_gpu.plan
LivenessOneShotRGB Estimation#
Name: LivenessOneShotRGBEstimator
Algorithm description:
This estimator shows whether the person's face is real or fake by the following types of attacks:
- Printed Photo Attack. One or several photos of another person are used.
- Video Replay Attack. A video of another person is used.
- Printed Mask Attack. An imposter cuts out a face from a photo and covers his face with it.
- 3D Mask Attack. An imposer puts on a 3D mask depicting the face of another person.
The requirements for the processed image and the face in the image are listed below.
Parameters | Requirements |
---|---|
Minimum resolution for mobile devices | 720x960 pixels |
Maximum resolution for mobile devices | 1080x1920 pixels |
Minimum resolution for webcams | 1280x720 pixels |
Maximum resolution for webcams | 1920x1080 pixels |
Compression | No |
Image warping | No |
Image cropping | No |
Effects overlay | No |
Mask | No |
Number of faces in the frame | 1 |
Face detection bounding box size | More than 200 pixels |
Frame edges offset | More than 10 pixels |
Head pose | -20 to +20 degrees for head pitch, yaw, and roll |
Image quality | The face in the frame should not be overexposed, underexposed, or blurred. |
See image quality thresholds in the "Image Quality Estimation" section.
Implementation description:
The estimator (see ILivenessOneShotRGBEstimator in ILivenessOneShotRGBEstimator.h):
-
Implements the estimate() function that needs
fsdk::Image
,fsdk::Detection
andfsdk::Landmarks5
objects (see section "Detection structure" in chapter "Face detection facility"). Output estimation is a structurefsdk::LivenessOneShotRGBEstimation
. -
Implements the estimate() function that needs the span of
fsdk::Image
, span offsdk::Detection
and span offsdk::Landmarks5
(see section "Detection structure" in chapter "Face detection facility").
The first output estimation is a span of structurefsdk::LivenessOneShotRGBEstimation
. The second output value (structurefsdk::LivenessOneShotRGBEstimation
) is the result of aggregation based on span of estimations announced above. Pay attention the second output value (aggregation) is optional, i.e.default argument
, which isnullptr
.
The LivenessOneShotRGBEstimation structure contains results of the estimation:
struct LivenessOneShotRGBEstimation {
enum class State {
Alive = 0, //!< The person on image is real
Fake, //!< The person on image is fake (photo, printed image)
Unknown //!< The liveness status of person on image is Unknown
};
float score; //!< Estimation score
State state; //!< Liveness status
float qualityScore; //!< Liveness quality score
};
Estimation score is normalized in range [0..1], where 1 - is real person, 0 - is fake.
Liveness quality score is an image quality estimation for the liveness recognition.
This parameter is used for filtering if it is possible to make bestshot when checking for liveness.
The reference score is 0,5.
The value of State
depends on score
and qualityThreshold
.
The value qualityThreshold
can be given as an argument of method estimate
(see ILivenessOneShotRGBEstimator
),
and in configuration file faceengine.conf (see ConfigurationGuide LivenessOneShotRGBEstimator
).
Recommended thresholds:
Table below contains thresholds from faceengine configuration file (faceengine.conf)
in the LivenessOneShotRGBEstimator::Settings
section.
By default, these threshold values are set to optimal.
"LivenessOneShotRGB estimator recommended thresholds"
Threshold | Recommended value |
---|---|
realThreshold | 0.5 |
qualityThreshold | 0.5 |
calibrationCoeff | 0.67 |
Configurations:
See the "LivenessOneShotRGBEstimator settings" section in the "ConfigurationGuide.pdf" document.
API structure name:
ILivenessOneShotRGBEstimator
Plan files:
- oslm_v4_model_1_cpu.plan
- oslm_v4_model_2_cpu.plan
- oslm_v4_model_1_arm.plan
- oslm_v4_model_2_arm.plan