Skip to main content

flutter_liveness 2.0.0 copy "flutter_liveness: ^2.0.0" to clipboard
flutter_liveness: ^2.0.0 copied to clipboard

On-device face liveness detection for Flutter using a MobileNetV2 model. Detect spoof attacks from photos and videos, no internet required.

2.0.0 #

Moves from tflite_flutter, which is no longer maintained, to flutter_litert.

Breaking changes #

  • Requires Flutter 3.38 (Dart 3.10), Android minSdk 24 and iOS 15.0
  • useGpu now uses the GPU only if its scores match the CPU's within 0.01 on three test images, checked in create(). Otherwise the model runs on the CPU
  • The GPU computes in 32-bit floats instead of 16-bit, which moved scores by up to 0.23 in testing
  • On Android, GPU inference runs on the isolate that called create(), because the Android GPU now goes through LiteRT's CompiledModel API, which has not been validated from other threads there

Changes #

  • Add FlutterLiveness.usesGpu
  • iOS GPU inference also goes through CompiledModel, on a background isolate. The Metal delegate is no longer used
  • dispose() frees the native copy of the model; tflite_flutter leaked about 9 MB per create()
  • No native library setup on macOS, Linux or Windows: flutter_litert bundles its runtimes
  • Tests now run the model on desktop

1.1.4 #

  • Fix concurrent analyze() calls returning isLive: true with a score of 0 without running the model. Calls are now queued and run one at a time
  • Fix a native crash when analyze() is called after dispose(); it now throws a StateError. dispose() waits for pending calls and can be called more than once
  • Fall back to the CPU when the GPU delegate cannot run the model, instead of failing in create(). dispose() now releases the GPU delegate
  • Fix wrong scores for 16-bit and floating-point images, and a RangeError for palette images
  • Report the real processing time, instead of zero, for images rejected by the Laplacian gate
  • Build the model input as a Float32List instead of nested lists, which removes a large per-call conversion cost
  • Document the options and result fields; the Laplacian descriptions were inaccurate
  • Remove the upper bound on the Flutter SDK constraint
  • Add unit tests

1.1.3 #

  • Update dependencies

1.1.2 #

  • Default CPU threads to 1
  • Small improvements

1.1.1 #

  • Update description
  • Small improvements

1.1.0 #

  • Can config use GPU
  • Can config CPU threads
  • Small improvements

1.0.0 #

  • Update Sigmoid score (probability of class=1)
  • Update result duration

0.0.2 #

  • Update LivenessResult

0.0.1+3 #

  • Update meta data

0.0.1+2 #

  • Update meta data

0.0.1+1 #

  • Update meta data

0.0.1 #

  • On-device face liveness / anti-spoofing detection
  • Bundled MobileNetV2 TFLite model (MIT licensed)
  • Image normalization + resize pipeline
  • Laplacian blur / clarity filter
  • TensorFlow Lite isolate execution for performance
  • Simple async API:
    • FlutterLiveness.create()
    • liveness.analyze(img)
    • liveness.dispose()
  • Works offline, real-time capable
  • Configurable thresholds & options
14
likes
160
points
185
downloads

Documentation

API reference

Publisher

verified publisherknottx.dev

Weekly Downloads

On-device face liveness detection for Flutter using a MobileNetV2 model. Detect spoof attacks from photos and videos, no internet required.

Repository (GitHub)
View/report issues

Topics

#liveness #detection #face #tflite #litert

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

flutter, flutter_litert, image

More

Packages that depend on flutter_liveness