Skip to content

Liveness check

The result of the liveness check consists of four parts: a status, a liveness check result, a box specifying the face analysed and a vector with validations checks that failed, if any. Result:

idliveface::FaceAnalysisResult result = pipeline->Analyse(image);

std::cout << result << std::endl;
if (result.status != idliveface::FaceStatus::kInvalid) {
    std::cout << "Image is " << result.status
              << ", probability is " << *result.genuine_probability << std::endl;
} else {
    std::cout << "Image did not pass validations and is not suitable for analysis\n"
              << "Failed validations: " << result.failed_validations << std::endl;
}
result = analyzer.analyze(image)

print(f"Result: {result}")
if result.status != idliveface.FaceStatus.INVALID:
    print(f"Image is {result.status}, probability is {result.genuine_probability}")
else:
    print("Image did not pass validations and is not suitable for analysis")
    print(f"Failed validations: {result.failed_validations}")
FaceAnalysisResult result = analyzer.analyze(image);

System.out.println("Result: " + result);
if (result.getStatus() != FaceStatus.INVALID) {
    System.out.println(
            "Image is " + result.getStatus() + ", probability is " + result.getGenuineProbability().get());
} else {
    System.out.println("Image did not pass validations and is not suitable for analysis");
    System.out.println("Failed validations: " + result.getFailedValidations());
}

Status it's an enum that provides an overall result of the analysis. It is set to kGenuine when the genuine_probability is higher or equal to 0.5, it is set to kNotGenunine when the probability is lower, and finally it is set to kInvalid if the face validations failed and a liveness analysis could not be performed.

genuine_probability is the probability that the face is genuine and belongs to a real person. Ranges from 0 (not genuine) to 1 (genuine). The face can be considered genuine when the probability is higher or equal to 0.5. Empty when the status is kInvalid.

box containing the bounding box around the detected face. Filled when the face was detected, even when the resulting status is kInvalid. Empty if no face was detected.

failed_validations Only filled when status is kInvalid it contains a list of face validations required to perform a liveness check that failed to pass. See Face detector

Additional parameters

Additionally, extra face analysis parameter can be passed to provide extra information and improve the liveness check. FaceAnalysisParameters has two fields: Domain and Tolerance.

The Domain can be set to kGeneral which is used by default of kDesktop if the target image is taken via a desktop web-camera.

The Tolerance defines how strict the face analysis should be, which in turn affects the APCER / BPCER balance. It can be set to: kRegular which is used by default, kSoft to achieve lower BPCER while still having acceptable APCER and finally to kHardened to target extra low APCER with higher BPCER.

idliveface::FaceAnalysisParameters analysis_params;
analysis_params.domain = idliveface::Domain::kDesktop;
analysis_params.tolerance = idliveface::Tolerance::kRegular;

const auto result = analyzer.Analyze(image, analysis_params);
domain = idliveface.Domain.DESKTOP
tolerance = idliveface.Tolerance.SOFT

result = analyzer.analyze(image, domain, tolerance)
FaceAnalysisParameters params = new FaceAnalysisParameters();
params.setDomain(Domain.DESKTOP);
params.setTolerance(Tolerance.SOFT);

FaceAnalysisResult result = analyzer.analyze(image, params);