Liveness Check
The Liveness Check is a process of determining whether the presented face is a real person, or if the presented face has been faked during some kind of so-called spoof attack. This process is sometimes also called a Spoof Check.
We recognize two approaches to a Liveness Check:
- Active Liveness is where the person needs to perform an extra action to prove genuineness and liveness
- Passive Liveness is proving genuineness and liveness without requiring the user to perform any additional action
The SmartFace currently supports Passive Liveness only, which is recommended for applications where the user’s experience and seamless app flow are paramount.
Neural Networks have been trained to detect real faces and various kinds of spoof attacks. Such spoof attacks include:
- Faces displayed on electronic screens
- Printed faces
- 2D masks
- 3D masks
The example of a presentation attack performed by the printed image.
Supported Passive Liveness Types
There are two passive liveness types available in the SmartFace Platform. They are optimized for different usage and use cases:
- distant passive liveness – suggested to be used on wild images (not recommended for selfies)
- nearby passive liveness – suggested to be used on selfie/enrollment images
Passive Liveness Inputs
The SmartFace Platform provides the passive liveness detection in :
- in real-time video processing, configurable at a camera level
- by a direct passive liveness REST API call
- integrated in the watchlist search process REST API call
A common rule “the better input the better result” applies to the Liveness Check even more. When designing an Access Control solution, some rules need to be followed to have a successful Liveness Check.
The recommended minimum requirements for the input are:
- Consider a camera placement and position - take the most frontal face image as possible
- A facial image with sufficient background must be submitted for evaluation
- A face should not be near the side of the image
- Not too strong backlight or sidelight
- No overexposed or underexposed images - mind a constant artificial light
- An image should not be cropped or compressed between the capture and processing step
Evaluating liveness explained
Liveness Check flow
Depending on the input for the liveness the evaluation flow is slightly different
- In real-time video processing only matched faces are evaluated for the liveness. If the detected face is not matched then no Liveness Check is performed. Keep in mind this condition while testing and configuring liveness during deploymnent.
- During direct API call, no matching is performed and Liveness Check is performed always.
- For the Watchlist Search API call same rule as for realtime video processing applies. Please see the flow chart.
Passive liveness conditions
When evaluating a liveness for provided image you can adjust Liveness Conditions in the spoofCheckConfig
. There are two sets of Liveness Conditions. One set is for the nearby Liveness Check, the other one is for the distant Liveness Check.
"spoofCheckConfig": {
"distantLivenessScoreThreshold": 90,
"nearbyLivenessScoreThreshold": 90,
"distantLivenessConditions": "default",
"nearbyLivenessConditions": "default",
"keepEvaluatingConditionsAfterFirstFail": false
}
The default values can be adjusted as needed however the default sets are recommended unless the environmental conditions of the image request it.
Default conditions to start distant passive liveness evaluation
Example for distant Liveness Condition string:
FACE_CONFIDENCE: [1000; 10000]
You can set additional attributes according to your use case.
Example for distant Liveness Condition string with additional attributes:
FACE_CONFIDENCE: [1000; 10000] && FACE_SIZE: [30; inf] && FACE_RELATIVE_AREA: [0.009; inf] && FACE_RELATIVE_AREA_IN_IMAGE: [0.9; inf] && YAW_ANGLE: [-20; 20] && PITCH_ANGLE: [-20; 20] && SHARPNESS_RAW: [5000; 70000] && BRIGHTNESS_RAW: [40000; 230000] && CONTRAST_RAW: [10000; 90000] && SPECULARITY_RAW: [5000; 80000]
Tables below list the additional parameters, description and their possible values.
Attribute | Min | Max |
---|---|---|
FACE_CONFIDENCE | 1000 | 10000 |
FACE_SIZE | 30 | infinity |
FACE_RELATIVE_AREA | 0.09 | infinity |
FACE_RELATIVE_AREA_IN_IMAGE | 0.9 | infinity |
YAW_ANGLE | -20 | 20 |
PITCH_ANGLE | -20 | 20 |
SHARPNESS_RAW | 5000 | 70000 |
BRIGHTNESS_RAW | 40000 | 230000 |
CONTRAST_RAW | 10000 | 90000 |
SPECULARITY_RAW | 5000 | 80000 |
Attribute | Decription |
---|---|
FACE_CONFIDENCE <0,10000> | Face attribute for evaluating confidence score of the face related to face detection. |
FACE_SIZE | Face attribute representing face size - the maximum of eye distance and eye-mouth distance. |
FACE_RELATIVE_AREA | Area of face relative to image size. |
FACE_RELATIVE_AREA_IN_IMAGE | Area of face visible in image relative to total area of face. This value implies the percentage of face area outside the image. |
YAW_ANGLE | Face attribute representing angle rotation of head towards camera reference frame around Y-axis as per DIN9300. |
PITCH_ANGLE | Face attribute representing angle rotation of head towards camera reference frame around X-axis as per DIN9300. |
SHARPNESS_RAW | Face attribute representing sharpness of the image before normalization. |
Default conditions to start nearby passive liveness evaluation
Example for nearby Liveness Condition string:
FACE_CONFIDENCE: [1000; 10000]
You can set additional attributes according to your use case.
Example for nearby Liveness Condition string with additional attributes:
FACE_CONFIDENCE: [1000; 10000] && FACE_SIZE: [60; inf] && FACE_RELATIVE_AREA: [0.25; inf] && YAW_ANGLE: [-20; 20] && PITCH_ANGLE: [-20; 20] && BRIGHTNESS: [-7800; 5000] && CONTRAST: [-5000; 6000] && SHARPNESS_RAW: [4000; inf] && UNIQUE_INTENSITY_LEVELS: [500; 10000]
Attribute | Min | Max |
---|---|---|
FACE_CONFIDENCE | 1000 | 10000 |
FACE_SIZE | 60 | infinity |
FACE_RELATIVE_AREA | 0.25 | infinity |
YAW_ANGLE | -20 | 20 |
PITCH_ANGLE | -20 | 20 |
BRIGHTNESS | -7800 | 5000 |
CONTRAST | -5000 | 6000 |
SHARPNESS_RAW | 4000 | infinity |
UNIQUE_INTENSITY_LEVELS | 500 | 10000 |
Attribute | Decription |
---|---|
FACE_CONFIDENCE <0,10000> | Face attribute for evaluating confidence score of the face related to face detection. |
FACE_SIZE | Face attribute representing face size - the maximum of eye distance and eye-mouth distance. |
FACE_RELATIVE_AREA | Area of face relative to image size. |
YAW_ANGLE | Face attribute representing angle rotation of head towards camera reference frame around Y-axis as per DIN9300. |
PITCH_ANGLE | Face attribute representing angle rotation of head towards camera reference frame around X-axis as per DIN9300. |
BRIGHTNESS <-10000~dark, 10000~light> | Face attribute for evaluating whether an area of face is correctly exposed. |
CONTRAST <-10000~low, 10000~high> | Face attribute for evaluating whether an area of face is contrast enough. |
SHARPNESS_RAW <-10000~blurry, 10000~sharp> | Face attribute representing sharpness of the image before normalization. |
UNIQUE_INTENSITY_LEVELS <-10000~few levels, 10000~enough levels> | Face attribute for evaluating whether an area of face has appropriate number of unique intensity levels. |
Passive liveness thresholds
The final decision of whether a face is real, or a spoof, should be determined by the passive liveness score and threshold. If the score is above the threshold, this can be interpreted as accepted. If the score is below the threshold, it is rejected.
Setting the correct threshold depends on the security/convenience balance that is required for the specific use case.
Thresholds for distant passive liveness:
False Accept Rate [%] | False Reject Rate [%] | Threshold |
---|---|---|
19.994 | 0.055 | 67.01692199707031 |
9.992 | 0.068 | 69.2877197265625 |
1.996 | 0.806 | 78.48787689208984 |
0.998 | 2.432 | 83.84744262695312 |
0.198 | 10.700 | 90.17024993896484 |
0.094 | 18.092 | 92.82566833496094 |
0.010 | 51.722 | 97.27446746826172 |
Thresholds for nearby passive liveness:
False Accept Rate [%] | False Reject Rate [%] | Threshold |
---|---|---|
19.999 | 0.305 | 74.63423156738281 |
9.998 | 1.536 | 81.77136993408203 |
2.000 | 8.800 | 89.43424987792969 |
1.000 | 13.523 | 91.35359954833984 |
0.199 | 26.425 | 94.28164672851562 |
0.099 | 33.646 | 95.55736541748047 |
0.019 | 54.978 | 97.1170883178711 |
0.008 | 59.248 | 97.44188690185547 |
Example:
Let’s set the threshold of distant passive liveness to 83.84. If we have a representative set of 10,000 real faces, statistically about 243 of the faces will be on average incorrectly marked as spoofs, even though they were real faces (False Reject Rate). If we have a set of 10,000 spoofs, statistically about 100 of the spoofs will be on average wrongly marked as real faces (False Accept Rate).
To make the Spoof/Liveness check more strict we can look for a higher Threshold, where it is less likely to accept a spoof face as a real one, while it will more likely consider a real face as a spoof face. If you set the Threshold to 92.82 instead, we will have about 9 faces incorrectly accepted out of 10,000 spoofs and about 1,809 real faces considered to be spoofs out of 10,000 real faces.
Parameters for the Liveness call
When setting up a call to the POST /api/v1/Faces/SpoofCheck endpoint the parameter spoofDetectorResourceIds
represents an array of liveness detectors what should be run during the spoof check.
"spoofDetectorResourceIds": [
"none"
],
Possible values are liveness_distant_any_remote
or liveness_distant_cpu_remote
or liveness_distant_gpu_remote
for a distant passive Liveness Check and liveness_nearby_any_remote
or liveness_nearby_cpu_remote
or liveness_nearby_gpu_remote
for a nearby passive Liveness Check.
gpu
version of spoof detector resources you need to have GPU acceleration properly set up. For more information about setting up the GPU acceleration please read this page.You can set thresholds for the Liveness Checks, ie. the number your Liveness score is compared against to decide whether the Liveness Check has passed. The threshold for the distant Liveness Check is set as distantLivenessScoreThreshold
and the threshold for a nearby Liveness Check is set as nearbyLivenessScoreThreshold
.
The value of keepEvaluatingConditionsAfterFirstFail
allows you to have full information about the reasons why the Liveness Check was not performed instead of only providing information about the first reason why it is not being performed.
"spoofCheckConfig": {
"distantLivenessScoreThreshold": 90,
"nearbyLivenessScoreThreshold": 90,
"distantLivenessConditions": "default",
"nearbyLivenessConditions": "default",
"keepEvaluatingConditionsAfterFirstFail": false
}
Responses of the Liveness call
The POST /api/v1/Faces/SpoofCheck endpoint responds with information about whether the Liveness Check was performed and whether it has succeeded. If it has succeeded the Liveness Check score is provided. The first level of information is an aggregation of both nearby and distant Liveness Checks. Then each check provides its information.
If the face is detected but the Liveness Check is not done due to the condition string not being fulfilled then the notPerformedReasons.reasonMessage
provides information about what condition(s) was/were not fulfilled.
{
"performed": true,
"passed": true,
"distantLivenessSpoofCheck": {
"performed": true,
"passed": true,
"score": 0,
"notPerformedReasons": [
{
"reasonMessage": "string"
}
]
},
"nearbyLivenessSpoofCheck": {
"performed": true,
"passed": true,
"score": 0,
"notPerformedReasons": [
{
"reasonMessage": "string"
}
]
}
}
Terms explained:performed
is true, if Liveness Checks fulfilled all the conditions.passed
is true, if Liveness Checks passed the Liveness Check.
Liveness Call Flow Chart
SpoofCheck response flowchart