Python Liveness PAD ExampleΒΆ

Initialize Liveness PAD model

from oneML import faceAPI as api
liveness_pad = api.LivenessPAD()

Initialize Liveness PAD module with licensing

from oneML import faceAPI as api
license_manager = api.LicenseManager()
license_manager.set_key("LICENSE_KEY_VALUE_HERE")
license_manager.activate_key()
liveness_pad = api.LivenessPAD(license_manager)

Read input as numpy array

image = np.array(cv2.cvtColor(cv2.imread(image_path), cv2.COLOR_BGR2RGB), dtype=np.uint8)

Run the model

ops = api.LivenessPADOps(True)
result = liveness_pad.run(image, ops)

And get the output

liveness = result.get_liveness()
liveness_score = result.get_liveness_score()
status = result.get_return_status()