flutter_liveness 2.0.0
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
minSdk24 and iOS 15.0 useGpunow uses the GPU only if its scores match the CPU's within 0.01 on three test images, checked increate(). 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'sCompiledModelAPI, 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_flutterleaked about 9 MB percreate()- No native library setup on macOS, Linux or Windows:
flutter_litertbundles its runtimes - Tests now run the model on desktop
1.1.4 #
- Fix concurrent
analyze()calls returningisLive: truewith 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 afterdispose(); it now throws aStateError.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
RangeErrorfor palette images - Report the real processing time, instead of zero, for images rejected by the Laplacian gate
- Build the model input as a
Float32Listinstead 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