Performing Offline OneShotLiveness estimation#
With LUNA ID, you can perform liveness estimation directly on your device. Unlike Online OneShotLiveness estimation, which sends requests to the LUNA PLATFORM 5 /liveness
endpoint, Offline OneShotLiveness estimation operates locally, ensuring faster processing and reduced dependency on backend services.
This feature allows you to determine whether the person in the image is a living individual or a spoof (for example, a photograph or mask).
In LUNA ID for Android#
To perform Offline OneShotLiveness estimation:
1․ Add the required dependency.
Add the appropriate dependency to your build.gradle file based on your device's architecture. This dependency includes the neural networks required for Offline OneShotLiveness estimation.
implementation("ai.visionlabs.lunaid:oslm-arm:X.X.X@aar")
2․ Specify the estimation type in LunaConfig
:
LunaConfig.create(
livenessType = LivenessType.Offline
)
3․ Specify the neural networks to be used for the estimation by using the LunaConfig.livenessNetVersion
parameter. This parameter is of type LivenessNetVersion
and supports two values:
Value | Description |
---|---|
LITE |
Default. Loads both neural network models: |
MOBILE |
Loads only the oneshot_rgb_liveness_v8_model_4_arm.plan model. Recommended for devices with lower performance. |
Important: After changing the
livenessNetVersion
parameter, restart the final application for the changes to take effect.
LunaConfig.create(
livenessType = LivenessType.Offline,
livenessNetVersion = LivenessNetVersion.LITE
)
Logging#
When configuring the livenessNetVersion
parameter, you can now monitor which networks are loaded directly from the logs:
livenessNetVersion = 1
- The system loads: oneshot_rgb_liveness_v11_model_6_arm.planlivenessNetVersion = 2
- The system loads: oneshot_rgb_liveness_v11_model_4_arm.plan and oneshot_rgb_liveness_v11_model_5_arm.plan
In LUNA ID for iOS#
To perform Offline OneShotLiveness estimation:
1․ Make sure that you have the following .plan files in your deployment directory:
- fsdk.framework/data/oneshot_rgb_liveness_v11_model_4_arm.plan
- fsdk.framework/data/oneshot_rgb_liveness_v11_model_5_arm.plan
- fsdk.framework/data/oneshot_rgb_liveness_v11_model_6_arm.plan
2․ Enable the estimation:
configuration.bestShotConfiguration.livenessType = LivenessType.Offline