Skip to content

Performing Offline OneShotLiveness estimation#

With LUNA ID POS, 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).

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 the neural network models:
  • oneshot_rgb_liveness_v12_model_4_arm.plan
  • oneshot_rgb_liveness_v12_model_5_arm.plan
  • MOBILE Loads only the oneshot_rgb_liveness_v12_model_6_arm.plan model.
    Recommended for devices with lower performance.

    Warning

    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_v12_model_6_arm.plan
    • livenessNetVersion = 2 - The system loads: oneshot_rgb_liveness_v12_model_4_arm.plan and oneshot_rgb_liveness_v12_model_5_arm.plan