Luxand FaceSDK v8.3 Developer's Guide

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.

View the iBeta Lab confirmation letter with the assessment results

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 at https://www.luxand.com/facesdk/download/.


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. Ensure that the data directory is in the application's working directory. If not, you can set it as follows:

int res = FSDK_SetParameter("LivenessModel", "external:dataDir=" + dataDirectory);

Possible returned error codes:

Error Code Description
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());
}

Using Tracker API

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

data
facesdk.dll
IBetaPlugin.dll
idliveface.dll
openvino.dll
openvino_intel_cpu_plugin.dll
openvino_ir_frontend.dll
tbb12.dll
plugins.xml

Linux

data
libtbb.so.X
libopenvino.so.X
libopenvino_ir_frontend.so.X
libopenvino_onnx_frontend.so.X
libfsdk.so
libIBetaPlugin.so
libidliveface.so
libopenvino_intel_cpu_plugin.so
plugins.xml

Android

app/src/main/assets/data
app/src/main/libs/external.jar
app/src/main/jniLibs/arm64-v8a/libfsdk.so
app/src/main/jniLibs/arm64-v8a/libIBetaPlugin.so
app/src/main/jniLibs/arm64-v8a/libidliveface.so
app/src/main/jniLibs/arm64-v8a/libtensorflowlite_c.so

(same file structure for armeabi-v7a and x86_64)

iOS

FaceSDK/data
FaceSDK/FaceSdk.framework
FaceSDK/fsdk.framework
FaceSDK/IBetaPlugin.framework
FaceSDK/LuxandFaceSDK.h

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

Good Example 1 Good Example 2

Correct, But Not Good Enough Samples

A distance between the camera and the face is too great:

Distance Too Great

The face is partially obscured by headwear:

Face Partially Obscured

Incorrect Samples

Poor lighting conditions:

Poor Lighting

Headwear obscures the face too much:

Obscures Too Much

Incorrect head rotation:

Incorrect Rotation

The face is too close to the camera:

Face Too Close

The face is positioned incorrectly, partially out of frame:

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:

Parameter Description Default
min_face_size Minimum width and height of the face box, in pixels 150
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. Value between 0 and 1. 0.15
detectable_face_size_relative Similar to above, but if the size of the face box is smaller than this value, the face is simply skipped. Used as a filter for small faces in the background. 0.075
min_pupillary_distance Minimum distance between the pupils on the face, in pixels 50
min_face_padding Minimum distance from the image's border to the face box, in pixels 15
max_roll Maximum roll angle of the head, in degrees 45
max_yaw Maximum yaw angle of the head, in degrees 30
max_pitch Maximum pitch angle of the head, in degrees 30