Skip to content

A personal demo project for Flutter + ONNX Runtime integration. Not related to any company work.A comprehensive on-device face recognition SDK for Flutter

License

Notifications You must be signed in to change notification settings

robert008/flutter_face_kit

Repository files navigation

Flutter Face Kit

Disclaimer

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.

Demo

face-kit-demo_demo.MOV

The demo video demonstrates:

  1. Airplane Mode Enabled ✈️ - Proving 100% offline operation with no network dependency
  2. Face Registration 📸 - Real-time face capture and feature extraction
  3. Face Recognition 🔍 - Instant matching against registered faces
  4. Complete Flow ✅ - End-to-end workflow running entirely on-device

All processing happens locally on the device with zero server communication.


Features

  • 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

Technical Highlights

  • 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

Architecture

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

Requirements

iOS

  • iOS 12.0 or later
  • Xcode 12.0 or later

Android

  • Android API level 21 (Android 5.0) or later
  • NDK support for arm64-v8a or armeabi-v7a

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_face_kit:
    git:
      url: https://github.com/robert008/flutter_face_kit.git

Usage

import 'package:flutter_face_kit/flutter_face_kit.dart';

// Initialize the plugin
final faceKit = FlutterFaceKit();

// Get platform version
String? version = await faceKit.getPlatformVersion();

Model Files

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 model
  • 2d106det.onnx - 106-point landmark detection
  • w600k_r50.onnx - Face recognition model
  • fasnet_v1se.onnx - Anti-spoofing model (optional)
  • fasnet_v2.onnx - Anti-spoofing model v2 (optional)

Performance

  • 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)

Roadmap

  • Face registration and database management
  • Quality assessment (pose, blur, lighting)
  • Multi-face detection and tracking
  • Face cropping and alignment utilities
  • Batch processing support

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

AI Models

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

Open Source Libraries

  • 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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Contact

Author: robert (robert008) Email: figo007007@gmail.com GitHub: https://github.com/robert008

For questions or feedback, please open an issue on GitHub.


Third-Party Licenses

About

A personal demo project for Flutter + ONNX Runtime integration. Not related to any company work.A comprehensive on-device face recognition SDK for Flutter

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published