Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FacePlugin

🌐 Company Site - Here

🤗 Hugging Face - Here

🛟 Help Center - Here

🐳 Docker Hub - Here

Face Recognition SDK — Flutter (Fully On-Premise)

Ready in ~15 minutes (after runtime download): Drop Android AAR + iOS frameworks → Run the example on a phone Jump: Quick start · Get the runtimes · Run the demo · Integrate into your app · Dart API

Customer repo name: FaceRecognition-Flutter

Quick start checklist

Use this for the example app (check each box in order):

  • Clone FaceRecognition-Flutter and run dart run tool/bootstrap.dart (or flutter pub get at root + example/)
  • Fix anything flutter doctor reports (Android toolchain, Xcode, licenses, JDK)
  • Download runtimes from Google Drive
  • Android: copy facerecognitionsdk.aarexample/android/libfacesdk/
  • iOS: unzip frameworks → ios/Frameworks/ (facerecognitionsdk, FaceRecognitionEngine, onnxruntime)
  • iOS (macOS): cd example/ios && pod install
  • cd example && flutter run (physical device recommended)
  • Home screen status bar shows Ready → Enroll / Identify / Capture / Attribute

Integrating into your own app? Skip to Integrate into your own app — Android AAR path is different (…/android/libs/ under the plugin dependency). Full API and layer guide: doc.faceplugin.com.

Introduction

Explore FacePlugin Face Recognition SDK for Flutter — enroll, 1:N identify with VideoWorker, oval capture coach, and face attributes with 2D liveness. The pub package face_recognition_sdk wraps the same native engines as our FaceRecognitionSDK Android and iOS apps.

This is an on-premise FacePlugin SDK. All processing stays on the device — no biometric data is sent to FacePlugin cloud.

This repository contains:

Folder Purpose
Repository root face_recognition_sdk — the Flutter plugin you depend on in your app
example/ Full demo (Enroll, Identify, Capture, Attribute, Settings, About)

Native binaries are not on GitHub (too large). Download them from Google Drive (links below) and copy into the paths shown.

Main Functionalities

Feature Supported
Gallery enroll (single face)
Live 1:N identify (VideoWorker)
2D liveness gate on identify
Oval capture coach + enroll
Gallery attributes + landmarks
Local person database (demo)
Settings (thresholds / clear DB)

Product List

Platform Repository
Android FaceRecognition-Android
iOS FaceRecognition-iOS
React Native FaceRecognition-React-Native
Flutter FaceRecognition-Flutter (this repo)
Ionic Cordova FaceRecognition-Ionic-Cordova
Windows (Recognition) FaceRecognition-Windows
Linux / Docker (Recognition) FaceRecognition-Docker
Windows (Liveness) FaceLivenessDetection-Windows
Linux / Docker (Liveness) FaceLivenessDetection-Docker

Before you start

Step What you need
1 Flutter (3.44+ recommended). Run flutter doctor and fix reported issues
2 JDK 17+ for Android. Prefer Android Studio’s bundled JDK. JAVA_HOME must point to the JDK home (folder that contains bin), not to bin itself. Optionally: flutter config --jdk-dir <path-to-jdk-home>
3 Accept Android licenses: flutter doctor --android-licenses
4 Physical device recommended (camera / liveness; emulator is limited)
5 Android facerecognitionsdk.aar and iOS frameworks — see Get the runtimes
6 Demo licenses are in example/lib/core/constants/license.dart (Android com.faceplugin.facerecognitionsdk, iOS com.faceplugin.facerecognition.app). Request a new key only if you change applicationId / bundle id — see SDK License

You can run the example app as-is after placing the runtimes. Home tiles unlock when the status bar shows Ready.

System requirements

Platform Requirement
Flutter 3.44+ (see pubspec.yaml)
Android minSdk 24, physical device recommended
iOS iOS 13+, physical device recommended
Dart 3.3+

Get the runtimes

Same Google Drive packs as FaceRecognitionSDK Android / iOS (includes frc.fpk models inside the runtime).

Android

Google Drive — Android

File Example app path Your own app path
facerecognitionsdk.aar example/android/libfacesdk/facerecognitionsdk.aar Your app’s android/libfacesdk/facerecognitionsdk.aar + include(":libfacesdk") (copy the module from the example — do not use implementation(files(…aar)) on the plugin)

iOS

Google Drive — iOS

Unzip into ios/Frameworks/:

ios/Frameworks/
├── facerecognitionsdk.framework
├── FaceRecognitionEngine.framework
└── onnxruntime.framework

Then on a Mac: dart run tool/bootstrap.dart (builds matching .xcframeworks) and cd example/ios && pod install. CocoaPods links the .xcframeworks into the plugin pod — plain .framework alone often leaves undefined FaceRecognitionSDK symbols under use_frameworks!.


Run the demo

git clone https://github.com/Faceplugin-ltd/FaceRecognition-Flutter.git
cd FaceRecognition-Flutter
dart run tool/bootstrap.dart
# Place AAR + iOS frameworks as above
cd example
flutter run

Keep demo ids for the included license:

Platform Id
Android applicationId com.faceplugin.facerecognitionsdk
iOS bundle id com.faceplugin.facerecognition.app
  1. Wait for the home status barReady.
  2. Use Enroll / Identify / Capture / Attribute.

Screenshots

Home Identify Capture

Home — Enroll, Identify, Capture, Attribute, Settings, About

Identify — live face box, landmarks, and liveness

Capture — oval coach with Move closer

Capture result Attribute Attribute (emotion)

Capture result — liveness, quality, Enroll

Attribute — 14 landmarks, liveness, age, gender

Attribute — landmarks, age, gender, emotion

Attribute (quality) Settings About

Attribute — blur, noise, pose, box

Settings — camera lens and thresholds

About — FacePlugin and Face Recognition SDK

Home (tiles) Attribute (liveness)

Home — six action tiles

Attribute — liveness spoof score, age, gender


SDK License

Licenses are offline and bound to your applicationId / bundle identifier.

The sample app already includes a valid key for com.faceplugin.facerecognitionsdk. You only need a new key if you use a different id.

How to get a license

The code below shows how to use the license:

const androidApplicationId = 'com.faceplugin.facerecognitionsdk';
const iosBundleId = 'com.faceplugin.facerecognition.app';
const androidLicense =
'FP1.RlBMMQMAAQDJx5NBpyjuxrTSuz8MAgAASPNMFWCS7q6vchdPDy23dWUgdnJm6T5LgA4HdMSGYv1yOd+oLCfrwRrNPknfqxACqbYHDTxu1SIMVNekHZW0lBnrkLNZvHNprQnTA/8GJ0XBhcT3+kUpasAT9GMzdBT5g7gM+FV8KTT2P71rWtYOIpDszqjhTpXBh0ZkSpRHFVftBlT+W94+4gLQmSg2VF6hMoPMazski4Llav+mfpgnoRDR67tcWhUyuf+wOnOS/v3uyhoE8AqXdpJKqhB4aVEXC/ZtjnQFuJwdANDSWRtzYBYX/Yb5rhzBc0c/p71ZcbP+ye054XUniZokjA/ZrQ+r4tftcAtF69sFiU60km2q6CtRu4tbQpL34YC2ztJPaLywBlwQz0lmEwXbKHmCHOc9SzdaYDWHt7lIgkxaEYztKGDjFzP0coB4R2MzKhh9vcZQePxo8TSwbZq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j13JBij9g9G/UHUFjkh+rpzIzRR8jUm2OvqEoumwCuFInnEbv2X889Mi/Y/Fq0PuWTwZ72tSHYsMc3lmANbPeBVZgOcppiiLwMVKol5T6zhcYPWgSPRRiytiLADCBiAJCAWPTjrXmiHhtgG+Kb/mFDrSn3ECPz2dhe6JWAlTYFvvGcGI8UL7iEYfnABq747W8ADpsSwTmFekDd5T/fjdF4MLxAkIByJ0V6SL5nsg1Ms1jtoBwed190hwTi7vKsPlePitp22HbTzYmvg3LpNb/X0ktQkKBKsN51OSCac3+QS4waP86ook=';

final act = await fr.setActivation(demoLicense());
debugPrint('[FaceRecognition] setActivation=$act');
if (act != fr.sdkSuccess) {
final detail = await fr.lastLicenseError();
_status = '${_statusLabel(act)}${detail.isNotEmpty ? ': $detail' : ''}';
_ready = false;
_loading = false;
notifyListeners();
return;
}
final code = await fr.init();

Please contact us to get a license for your own app.


Integrate into your own app

You need the Flutter plugin + native runtimes. You do not need the example UI or person database (those are demo-only).

  1. Add a path or git dependency:
dependencies:
  face_recognition_sdk:
    git:
      url: https://github.com/Faceplugin-ltd/FaceRecognition-Flutter.git

Or path:

dependencies:
  face_recognition_sdk:
    path: ../FaceRecognition-Flutter
  1. Copy runtimes:
Platform Copy to
Android Copy example/android/libfacesdk/ into your app android/libfacesdk/, put facerecognitionsdk.aar there, and include(":libfacesdk") in settings.gradle(.kts). (Do not implementation(files(…aar)) inside the plugin — AGP will fail bundleDebugAar.)
iOS Plugin checkout ios/Frameworks/ (three frameworks), then pod install
  1. Set your applicationId / iOS bundle id and request a license for that id (not the demo id).

  2. Permissions: camera + photo library (see example AndroidManifest.xml / Info.plist).

  3. Minimal usage:

import 'package:face_recognition_sdk/face_recognition_sdk.dart';

Future<void> activate() async {
  final code = await getMachineCode(); // FPMC1.… — send when requesting a key
  final act = await setActivation('FP1.…'); // bound to YOUR applicationId / bundle id
  if (act != sdkSuccess) {
    throw StateError(await lastLicenseError());
  }
  final initCode = await init();
  if (initCode != sdkSuccess) {
    throw StateError('init failed: $initCode');
  }
}

Future<void> enrollStill(String imagePath) async {
  final faces = await faceDetection(imagePath);
  if (faces.length != 1) return;
  final template = await templateExtraction(imagePath, faces.first);
  final cropB64 = await cropFace(imagePath, faces.first);
  // Store template + crop in YOUR database
}

Thresholds (identify, liveness, pose, eye-close, Capture settings) are parameters you pass from Dart — change them freely for your product. Defaults in the example Settings match FaceRecognitionSDK Apps (identify 0.67, liveness 0.5, level 0, pose 40°, eyeclose 0.5).


About SDK (Dart API)

Call order: getMachineCodesetActivationinit → detect / VideoWorker → deinit when done.

API Purpose
getMachineCode() FPMC1.… for license requests
setActivation(license) Activate with FP1.…
init() / deinit() Load / unload engine
faceDetection(image, param?) Canonical FaceBox list
detect(image, crop?, flags?) Raw engine JSON
templateExtraction / cropFace / similarity Enroll + 1:1 match
startVideoWorker / syncVideoWorkerDatabase / ingestLiveCameraFrame Live 1:N
videoWorkerEvents Stream of tracking / match JSON
FaceCapture Optional oval capture UI (package:face_recognition_sdk/capture)
lastLicenseError() Human-readable license failure

FaceBox (cheat sheet)

Boxes include geometry (x1,y1,x2,y2), pose, liveness / quality / eyes / occlusion scores and labels, age / gender / emotion / mask / glasses, optional attributes map, and landmarks + landmarkCount.

Status codes

Code Meaning
0 Success
1 License invalid
2 License expired
3 Not activated
4 Init failed

Example app layout

Path Role
example/lib/core/constants/license.dart Demo FP1 keys only
example/lib/services/ SdkService, Settings, PersonDatabase (demo)
example/lib/screens/ Home, Identify, Capture, Attribute, Result, Settings, About

Troubleshooting

Symptom What to check
License invalid / expired applicationId / bundle id must match the FP1.… key (com.faceplugin.facerecognitionsdk / com.faceplugin.facerecognition.app for the demo). LICENSE_MACHINE_MISMATCH usually means the package id does not match the key.
Missing AAR / Gradle error Place facerecognitionsdk.aar in example/android/libfacesdk/ (demo). Own app: :libfacesdk module — never drop the AAR only into the plugin android/libs/
bundleDebugAar / local .aar AGP blocks implementation(files(*.aar)) on plugin libraries. Use :libfacesdk (see android/libs/README.md)
iOS link / missing symbols Put frameworks in plugin ios/Frameworks/ (not example/ios/), then cd example/ios && pod install and rebuild. Copying after a failed pod install without re-running pods leaves undefined FaceRecognitionSDK symbols.
Home tiles stay disabled Wait for Ready; check status bar / lastLicenseError()
Identify never matches Enroll at least one person; adjust identify threshold in Settings
Camera permission denied Grant camera (and photos for gallery enroll)
Emulator issues Use a physical device for camera / liveness
flutter doctor failures Fix JDK / Android licenses / Xcode before building

Contact

faceplugin.comfaceplugin.com

About

Face Recognition, Face Liveness Detection, Face Anti-Spoofing, Face Detection, Face Landmarks, Face Compare, Face Matching, Face Pose, Face Expression, Face Attributes, Face Templates Extraction, Face Landmarks

Topics

Resources

Stars

20 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages