Luxand FaceSDK – iBeta Certified Liveness Add-on
Available for Linux, Windows (x64), Android and iOS.
iBeta certified Liveness add-on for FaceSDK passed Level 1 iBeta Presentation Attack Detection (PAD) conformance testing with a perfect PAD score. iBeta Quality Assurance conducted Presentation Attack Detection (PAD) testing in accordance with ISO/IEC 30107-3. iBeta is accredited by NIST/NVLAP (NVLAP Lab Code: 200962) to test and provide results to this PAD standard.
During the evaluation, iBeta researchers conducted about a thousand presentation attacks using subjects’ authentic biometric samples to create artifacts. None of these presentation attacks were successful, resulting in an Attack Presentation Classification Error Rate (APCER) of 0%.
As a uniquely accredited third-party biometrics testing lab, iBeta Quality Assurance ensures that products meet the highest standards of functionality and security. The iBeta certification guarantees the most precise liveness and anti-spoofing checks for images and videos.
Sample projects are available in samples\ibeta liveness add-on directory.
Activation
iBeta liveness add-on requires a license key, which should be installed on the target Windows, or Linux system before starting your application.
If the key is not present you will be unable to use the iBeta add-on. The license key is a file with the .v2c extension, you can find it in the sample's license directory. To install it, run the install_license utility that is bundled along with the key: install_license *.v2c
Initialization
To initialize the iBeta add-on you should call the following function:
int res = FSDK_SetParameter("LivenessModel", "external");
The returned value should be equal to FSDKE_OK.
Possible returned error codes:
FSDKE_PLUGIN_NO_PERMISSION |
You don’t have permission to use the iBeta add-on (e.g., incorrect FaceSDK license key type) |
FSDKE_PLUGIN_NOT_LOADED |
Something went wrong during the add-on loading. Ensure that all necessary files are available and exist in the application’s working directory. |
General usage
To check liveness on an image, load the image using the FSDK_LoadImageFromFile function, detect facial features, and then obtain the liveness attribute using these features. Below is a code sample in C++:
HImage img;
FSDK_Features features;
char attributes[512];
float liveness = 0.0f;
float image_quality = 0.0f;
const char* image = “image.png”;
FSDK_LoadImageFromFile(&img, image);
FSDK_DetectFacialFeatures(img, &features);
FSDK_DetectFacialAttributeUsingFeatures(img, &features, "Liveness", attributes, 512);
FSDK_GetValueConfidence(attributes, "Liveness", &liveness);
FSDK_GetValueConfidence(attributes, "ImageQuality", &image_quality);
Note that you should check the returning values of every function.
The main factor in determining whether the image is live or spoofed is the liveness value (probability). An image can be considered live if the liveness value is higher than 0.5. An additional factor to consider is the image_quality value, which measures how "appropriate" the image is for the liveness check. Images with quality values lower than 0.5 should generally be rejected. Both measurements are float values in the range of [0, 1].
Sometimes an image may be rejected. If this happens, you can get a liveness check error message in the attributes variable after the "LivenessError=" prefix. An example of error parsing in C++:
string e = "LivenessError=";
if (string(attributes).find(e) != string::npos) {
string livenessErrorMessage = string(attributes).substr(e.length());
}
When using the Tracker API with the iBeta add-on, you should set the following parameters:
FSDK_SetTrackerParameter(tracker, "DetectLiveness", "true");
FSDK_SetTrackerParameter(tracker, "SmoothAttributeLiveness", "false");
FSDK_SetTrackerParameter(tracker, "AttributeLivenessSmoothingAlpha", "1");
FSDK_SetTrackerParameter(tracker, "LivenessFramesCount", "1");
Sample code in C++ for Tracker API:
HImage image;
char attributes[1024];
char err[1024];
float liveness = 0.0f;
float image_quality = 0.0f;
std::string e = "LivenessError=";
while (!is_finished) {
FSDK_FeedFrame(tracker, camera, image, &count, ids, 256 * sizeof(long long));
FSDK_GetTrackerFacialAttribute(tracker, camera, ids[0], "Liveness", attributes, 1024);
FSDK_GetValueConfidence(attributes, "Liveness", &liveness);
FSDK_GetValueConfidence(attributes, "ImageQuality", &image_quality);
FSDK_GetTrackerFacialAttribute(tracker, camera, ids[0], "LivenessError", err, 1024);
string livenessError = string(err).substr(e.length());
}
iBeta liveness add-on files
To use the iBeta add-on, ensure that all necessary files are in the application's working directory. Below is a list of required files and directories for the supported platforms:
Windows |
Linux |
Android |
iOS |
data
|
data
|
app/src/main/assets/data
|
FaceSDK/data
|
Image requirements
Image format
Lossless formats are preferred, as lossy compression can negatively affect accuracy.
If you use lossy formats, make sure the compression is at a minimal level.
For example, for JPEG, 70 is the lowest practical compression level.
Image resolution
The iBeta Liveness add-on processes the area around the face, so the optimal resolution will depend on the image composition. Assuming a portrait orientation with the face centered and occupying at least 1/4 of the image area, the recommended image resolution range is from 600x800 to 960x1280.
Image composition
- There should be only one main face in the image. It should be fully visible within the frame, fully open, and without any occlusions. Cropping is not allowed. Small faces in the background are not taken into account.
- The minimum size of a face box that can be processed is 150x150 pixels.
- The padding between the face box and the image's borders should be at least 15 pixels.
- The distance between the pupils on the face should be at least 50 pixels.
- The out-of-plane rotation angle (face pitch and yaw) should be no more than ±30 degrees.
Images that do not meet these conditions will be rejected. Other factors that can affect accuracy include:
- Motion blur can significantly increase BPCER (the rate of errors classifying a genuine person as a spoof).
- Texture filtering can significantly increase APCER (the rate of errors allowing impostors through).
- Spotlights on the face and nearby surroundings can significantly increase BPCER.
- Poorly lit environments and colored lighting can significantly increase BPCER.
- Fish-eye lenses are not supported.
- Sunglasses may cause confusion.
Sample images
This section contains image samples categorized into three groups:
- Good samples: Images with optimal face size, positioning, and lighting conditions.
- Acceptable but suboptimal samples: Images that are acceptable but were taken under less-than-ideal conditions.
- Incorrect samples: Images that are not acceptable for processing.
Good examples
Correct, but not good enough samples
A distance between the camera and the face is too great:
The face is partially obscured by headwear:
Incorrect samples
Poor lighting conditions:
Headwear obscures the face too much:
Incorrect head rotation:
The face is too close to the camera:
The face is positioned incorrectly, partially out of frame:
Configuration files
It is possible to change internal parameters used to validate the image. Lower values will result in fewer images being rejected, but accuracy may degrade for such images. The parameters are defined in the data/preprocessing/face_params.conf file. Available parameters:
- min_face_size: Minimum width and height of the face box, in pixels (150 - default).
- min_face_size_relative: Minimum relative width and height of the face box, as a ratio of the face's width and height to the image's width and height. Defined as a value between 0 and 1. For example, if the value is 0.25, one side of the face box should be at least a quarter of the image's corresponding side (0.15 - default).
- detectable_face_size_relative: Similar to the parameter above, but if the size of the face box is smaller than this value, the face is simply skipped. This is used as a filter for small faces in the background (0.075 - default).
- min_pupillary_distance: Minimum distance between the pupils on the face, in pixels (50 - default).
- min_face_padding: Minimum distance from the image's border to the face box, in pixels (15 - default).
- max_roll: Maximum roll angle of the head, in degrees (45 - default).
- max_yaw: Maximum yaw angle of the head, in degrees (30 - default).
- max_pitch: Maximum pitch angle of the head, in degrees (30 - default).