This repository is a technical demo project created for learning and showcase purposes. It is independent from any company or commercial product, and does not use any proprietary code or data. All AI models referenced (e.g. InsightFace, ONNX Runtime, OpenCV) are open-source and properly attributed.
A Flutter plugin showcasing on-device face recognition with real-time detection, landmark extraction, and facial recognition capabilities.
face-kit-demo_demo.MOV
The demo video demonstrates:
- Airplane Mode Enabled
✈️ - Proving 100% offline operation with no network dependency - Face Registration 📸 - Real-time face capture and feature extraction
- Face Recognition 🔍 - Instant matching against registered faces
- Complete Flow ✅ - End-to-end workflow running entirely on-device
All processing happens locally on the device with zero server communication.
- Face Detection: High-accuracy face detection using optimized ONNX models
- Landmark Extraction: 106-point facial landmark detection
- Face Recognition: Real-time facial feature extraction and matching
- On-Device Processing: Complete privacy-first solution with no server dependency
- Cross-Platform: Supports both iOS and Android
- High Performance: Optimized processing pipeline with <500ms latency
- FFI Integration: Direct native library integration for maximum performance
- Zero Server Dependency: All processing happens on-device
- Optimized Performance: 10x performance improvement (5s → 500ms)
- Privacy-First: No data leaves the device
- Technical Demonstration: Face quality assessment and pose estimation capabilities
- Native Integration: Uses ONNX Runtime and OpenCV for optimal performance
This plugin uses Flutter's FFI (Foreign Function Interface) to integrate high-performance native libraries:
- iOS: Pre-compiled static library with Objective-C wrapper
- Android: JNI libraries supporting arm64-v8a and armeabi-v7a architectures
- Models: ONNX format models for detection, landmarks, and recognition
- iOS 12.0 or later
- Xcode 12.0 or later
- Android API level 21 (Android 5.0) or later
- NDK support for arm64-v8a or armeabi-v7a
Add this to your package's pubspec.yaml file:
dependencies:
flutter_face_kit:
git:
url: https://github.com/robert008/flutter_face_kit.gitimport 'package:flutter_face_kit/flutter_face_kit.dart';
// Initialize the plugin
final faceKit = FlutterFaceKit();
// Get platform version
String? version = await faceKit.getPlatformVersion();The SDK requires ONNX model files which are distributed separately due to size constraints. Please download the models from the releases page and place them in the appropriate assets directory.
Required models:
det_10g.onnx- Face detection model2d106det.onnx- 106-point landmark detectionw600k_r50.onnx- Face recognition modelfasnet_v1se.onnx- Anti-spoofing model (optional)fasnet_v2.onnx- Anti-spoofing model v2 (optional)
- Detection: ~200ms per frame
- Landmark Extraction: ~100ms per face
- Recognition: ~200ms per face
- Total Pipeline: <500ms for complete processing
Tested on:
- iPhone 12 Pro (iOS 15)
- Samsung Galaxy S21 (Android 12)
- Face registration and database management
- Quality assessment (pose, blur, lighting)
- Multi-face detection and tracking
- Face cropping and alignment utilities
- Batch processing support
This project is licensed under the MIT License - see the LICENSE file for details.
This project uses AI models from InsightFace (MIT License):
- Face Detection Model (det_10g.onnx) - Buffalo_L model
- Face Recognition Model (w600k_r50.onnx) - W600K ResNet50 model
- 2D Landmark Model (2d106det.onnx) - 106-point landmark detector
- Anti-Spoofing Models (fasnet_v1se.onnx, fasnet_v2.onnx) - FASNet
- ONNX Runtime (MIT License) - High-performance AI model inference engine
- OpenCV (Apache 2.0 License) - Computer vision and image processing library
- Flutter FFI for native integration
Contributions are welcome! Please feel free to submit a Pull Request.
Author: robert (robert008) Email: figo007007@gmail.com GitHub: https://github.com/robert008
For questions or feedback, please open an issue on GitHub.
- InsightFace — MIT License — https://github.com/deepinsight/insightface
- ONNX Runtime — MIT License — https://github.com/microsoft/onnxruntime
- OpenCV — Apache 2.0 License — https://github.com/opencv/opencv