Skip to main content
Version: 3.22.0 (latest)

Liveness estimation

2D RGB Real Person Face Estimation

Modifications of Liveness estimation block

  • 2d — estimation of face belonging to a real person by image (Previous modification of "v4").

  • 2d_light — more lightweight and faster algorithms compared to 2d. Suitable for use on mobile devices.

  • 2d_additional_check — estimation of a face belonging to a real person by image with additional checks.

    Modification Version Detection time (ms)APCER[BPCER=0.05]
    2d_additional_check1 410.37
    2d1 6940.35
    2 2500.1
    2d_light1 60.14
    2 180.09

Configuration

  • "capturer_config_name" is face detector configuration file. The file used by default is "common_capturer_uld_fda.xml" (Capturer object configuration files).
  • "config_name" is the Liveness estimator configuration file. The file used by default is "liveness_2d_estimator_v3.xml" (Liveness2DEstimator class).

Processing Block configurable parameters

Default values of parameters
Modification
Version
confidence_threshold
2d 1 0.8
2 0.7
2d_light 1 0.56
2 0.42

Processing Block specification

  1. Input Context must contain an image in binary format.
{
"image" : {
"format": "NDARRAY",
"blob": "data pointer",
"dtype": "uint8_t",
"shape": [height, width, channels]
}
}
  1. After calling the Processing Block, an array of objects containing one object is added. The object will contain the coordinates of the bounding box, the detection confidence, the class and the liveness field. By the "liveness" key, a Context object containing 3 elements is available:
  • "confidence" key with a value of type double in the range[0,1]
  • "value" key with a value of type string, which corresponds to one of two states: "REAL" or "FAKE"
  • "info" key with a string value that corresponds to one of the states pbio::Liveness2DEstimator::Liveness

The specification of the output Context:

{
"image" : {},
"objects": [{
"id": {"type": "long", "minimum": 0},
"class": "face",
"confidence": {"double", "minimum": 0, "maximum": 1},
"bbox": [x1, y2, x2, y2],
"liveness": {
"confidence": {"type": "double", "minimum": 0, "maximum": 1},
"info": {
"enum": [
"FACE_NOT_FULLY_FRAMED", "MULTIPLE_FACE_FRAMED",
"FACE_TURNED_RIGHT", "FACE_TURNED_LEFT", "FACE_TURNED_UP",
"FACE_TURNED_DOWN", "BAD_IMAGE_LIGHTING", "BAD_IMAGE_NOISE",
"BAD_IMAGE_BLUR", "BAD_IMAGE_FLARE", "NOT_COMPUTED"
]
},
"value": {"enum": ["REAL", "FAKE"]}
}
}]
}

Example

To estimate whether a face belongs to a real person in the image, follow the steps below:

  1. Create a Context configuration container and specify the values "unit_type", "modification", "version" and other parameters of the block you are interested in. An example of creating a processing block can be found on the Working with Processing Block page.
auto configCtx = service->createContext();
configCtx["unit_type"] = "LIVENESS_ESTIMATOR";
configCtx["modification"] = "2d";
pbio::ProcessingBlock blockLiveness = service->createProcessingBlock(configCtx);
  1. Pass the input Context-container corresponding to the block modification to the "blockLiveness()" method:
  • "2d" is a Context-container received after the processing blocks of face and fitter detection work
  • "2d_additional_check" is a Context-container containing an image in binary format
//------------------
// creating face detection processing blocks, and Context container with binary image
//------------------

faceDetector(ioData)
faceFitter(ioData)
blockLiveness(ioData);