While being able to identify a person by performing a search on an image is great, it is not always sufficient as someone could simply use a printed picture of a person to fool the system.

In use cases such as Access Control, Know Your Customer, Customer Onboarding, we also need to check if the image provided to the system is live, i.e. is an actual live person, and not a paper/screen showing their photo.

To facilitate this, we have the liveness API.

As usual, we start by creating a request:

from import LivenessRequest, DeviceType
from pathlib import Path

image_base_path = Path("sample_images")
image_path = image_base_path / "orkhan-real.jpg"

liveness_request = LivenessRequest(image_path, DeviceType.IOS)

And then we get the response:

response = sdk.liveness.check_liveness(liveness_request)

The image passed in the request should be a high quality image, sufficiently close to the camera.

The returned score represents how confident the system is that this is a real image vs a printed/screen one.