|
1 | | -# FaceAttribute-Flutter |
| 1 | +<p align="center"> |
| 2 | + <a href="https://play.google.com/store/apps/dev?id=7086930298279250852" target="_blank"> |
| 3 | + <img alt="" src="https://github-production-user-asset-6210df.s3.amazonaws.com/125717930/246971879-8ce757c3-90dc-438d-807f-3f3d29ddc064.png" width=500/> |
| 4 | + </a> |
| 5 | +</p> |
| 6 | + |
| 7 | +#### 📚 Product & Resources - [Here](https://github.com/kby-ai/Product) |
| 8 | +#### 🛟 Help Center - [Here](https://docs.kby-ai.com) |
| 9 | +#### 💼 KYC Verification Demo - [Here](https://github.com/kby-ai/KYC-Verification-Demo-Android) |
| 10 | +#### 🙋♀️ Docker Hub - [Here](https://hub.docker.com/u/kbyai) |
| 11 | + |
| 12 | +# FaceAttribute-Flutter |
| 13 | +## Overview |
| 14 | +We implemented `face auto-capture` functionality in this repo.</br> |
| 15 | +We have also implemented `face liveness detection`, `face recognition`, `pose estimation`, `face quality calculation`, `face landmark detection`, `face occlusion detection`, `eye closure detection`, `age/gender estimation` with Flutter framework as well.</br> |
| 16 | + |
| 17 | +> In this repository, we integrated KBY-AI's `face premium SDK` into the Flutter project for both Android and iOS.</br> |
| 18 | +### ◾FaceSDK(Mobile) Details |
| 19 | + |
| 20 | + | Basic | Standard | 🔽 Premium | |
| 21 | + |------------------|------------------|------------------| |
| 22 | + | Face Detection | Face Detection | <b>Face Detection</b> | |
| 23 | + | Face Liveness Detection | Face Liveness Detection | <b>Face Liveness Detection</b> | |
| 24 | + | Pose Estimation | Pose Estimation | <b>Pose Estimation</b> | |
| 25 | + | | Face Recognition | <b>Face Recognition</b> | |
| 26 | + | | | <b>68 points Face Landmark Detection</b> | |
| 27 | + | | | <b>Face Quality Calculation</b> | |
| 28 | + | | | <b>Face Occlusion Detection</b> | |
| 29 | + | | | <b>Eye Closure Detection</b> | |
| 30 | + | | | <b>Age, Gender Estimation</b> | |
| 31 | + |
| 32 | +### ◾FaceSDK(Mobile) Product List |
| 33 | + | No. | Repository | SDK Details | |
| 34 | + |------------------|------------------|------------------| |
| 35 | + | 1 | [Face Liveness Detection - Android](https://github.com/kby-ai/FaceLivenessDetection-Android) | Basic SDK | |
| 36 | + | 2 | [Face Liveness Detection - iOS](https://github.com/kby-ai/FaceLivenessDetection-iOS) | Basic SDK | |
| 37 | + | 3 | [Face Recognition - Android](https://github.com/kby-ai/FaceRecognition-Android) | Standard SDK | |
| 38 | + | 4 | [Face Recognition - iOS](https://github.com/kby-ai/FaceRecognition-iOS) | Standard SDK | |
| 39 | + | 5 | [Face Recognition - Flutter](https://github.com/kby-ai/FaceRecognition-Flutter) | <b>Standard SDK</b> | |
| 40 | + | 6 | [Face Recognition - React-Native](https://github.com/kby-ai/FaceRecognition-React-Native) | Standard SDK | |
| 41 | + | 7 | [Face Attribute - Android](https://github.com/kby-ai/FaceAttribute-Android) | Premium SDK | |
| 42 | + | 8 | [Face Attribute - iOS](https://github.com/kby-ai/FaceAttribute-iOS) | Premium SDK | |
| 43 | + | ➡️ | <b>[Face Attribute - Flutter](https://github.com/kby-ai/FaceAttribute-iOS)</b> | Premium SDK | |
| 44 | + |
| 45 | + > To get Face SDK(server), please visit products [here](https://github.com/kby-ai/Product).<br/> |
| 46 | +
|
| 47 | +## Try with Demo App |
| 48 | + |
| 49 | +### Google Play |
| 50 | + |
| 51 | +<a href="https://play.google.com/store/apps/details?id=com.kbyai.facerecognition" target="_blank"> |
| 52 | + <img alt="" src="https://user-images.githubusercontent.com/125717930/230804673-17c99e7d-6a21-4a64-8b9e-a465142da148.png" height=80/> |
| 53 | +</a> |
| 54 | + |
| 55 | +### App Store |
| 56 | + |
| 57 | +<a href="https://apps.apple.com/us/app/kby-ai-face-recognition/id6448648922" target="_blank"> |
| 58 | + <img alt="" src="https://user-images.githubusercontent.com/125717930/235276083-d20fe057-214d-497c-a431-4569bbeed2fe.png" height=80/> |
| 59 | +</a> |
| 60 | + |
| 61 | +## Performance Video |
| 62 | + |
| 63 | +You can visit our YouTube video [here](https://www.youtube.com/watch?v=M7t_dpT-hOI) to see how well our demo app works.</br> |
| 64 | +[](https://www.youtube.com/watch?v=M7t_dpT-hOI) |
| 65 | + |
| 66 | +## Screenshots |
| 67 | +<p float="left"> |
| 68 | + <img src="https://github.com/kby-ai/FaceRecognition-Flutter/assets/125717930/724fa0e5-7d32-45f4-9d63-c192e79c15a0" width=200/> |
| 69 | + <img src="https://github.com/kby-ai/FaceRecognition-Flutter/assets/125717930/ea7f4653-10dc-45d4-a00c-2ae65cfd678b" width=200/> |
| 70 | + <img src="https://github.com/kby-ai/FaceRecognition-Flutter/assets/125717930/f1b0a0cd-5e5d-4b03-9dae-a1d3839eb8ee" width=200/> |
| 71 | +</p> |
| 72 | + |
| 73 | +<p float="left"> |
| 74 | + |
| 75 | + <img src="https://github.com/kby-ai/FaceRecognition-Flutter/assets/125717930/cd8d4643-cbca-4fc5-b239-574383bbdc88" width=200/> |
| 76 | + <img src="https://github.com/kby-ai/FaceRecognition-Flutter/assets/125717930/763dd8fa-2463-4534-9497-370b4a9dfd62" width=200/> |
| 77 | + <img src="https://github.com/kby-ai/FaceRecognition-Flutter/assets/125717930/26f1c3aa-d90a-4935-af8a-bff6741bbefc" width=200/> |
| 78 | +</p> |
| 79 | + |
| 80 | +## SDK License |
| 81 | + |
| 82 | +The face recognition project relies on our SDK, which requires a license for each application ID.</br> |
| 83 | +- The code below shows how to use the license: https://github.com/kby-ai/FaceRecognition-Flutter/blob/0ed0fea9f86d73d08aff81e25da479c62f2ebc05/lib/main.dart#L68-L94 |
| 84 | + |
| 85 | +- To request a license, please contact us:</br> |
| 86 | + |
| 87 | +🧙`Telegram:` [@kbyai](https://t.me/kbyai)</br> |
| 88 | +🧙`WhatsApp:` [+19092802609](https://wa.me/+19092802609)</br> |
| 89 | +🧙`Skype:` [live:.cid.66e2522354b1049b](https://join.skype.com/invite/OffY2r1NUFev)</br> |
| 90 | +🧙`Facebook:` https://www.facebook.com/KBYAI</br> |
| 91 | + |
| 92 | +## How To Run |
| 93 | +### 1. Flutter Setup |
| 94 | + Make sure you have Flutter installed. </br> |
| 95 | + We have tested the project with Flutter version 3.10.2.</br> |
| 96 | + If you don't have Flutter installed, please follow the instructions provided in the official Flutter documentation [here](https://docs.flutter.dev/get-started/install).</br> |
| 97 | +### 2. Running the App |
| 98 | + Run the following commands: |
| 99 | + |
| 100 | + ```bash |
| 101 | + flutter pub upgrade |
| 102 | + flutter run |
| 103 | + ``` |
| 104 | + If you plan to run the iOS app, please refer to the following [link](https://docs.flutter.dev/deployment/ios) for detailed instructions.</br> |
| 105 | +## About SDK |
| 106 | +### 1. Setup |
| 107 | +### 1.1 Setting Up Face SDK |
| 108 | + > Android |
| 109 | +
|
| 110 | + - Copy the SDK (folder `libfacesdk`) to the folder `android` in your project.</br> |
| 111 | + - Add SDK to the project in `settings.gradle`. |
| 112 | + ```dart |
| 113 | + include ':libfacesdk' |
| 114 | + ``` |
| 115 | +#### 1.2 Setting Up Face SDK Plugin |
| 116 | + - Copy the folder `facesdk_plugin` to the root folder of your project.</br> |
| 117 | + - Add the dependency in your `pubspec.yaml` file. |
| 118 | + ```dart |
| 119 | + facesdk_plugin: |
| 120 | + path: ./facesdk_plugin |
| 121 | + ``` |
| 122 | + - Import the `facesdk_plugin` package. |
| 123 | + ```dart |
| 124 | + import 'package:facesdk_plugin/facesdk_plugin.dart'; |
| 125 | + import 'package:facesdk_plugin/facedetection_interface.dart'; |
| 126 | + ``` |
| 127 | +### 2 API Usages |
| 128 | +#### 2.1 Facesdk Plugin |
| 129 | + - Activate the `FacesdkPlugin` by calling the `setActivation` method: |
| 130 | + ```dart |
| 131 | + final _facesdkPlugin = FacesdkPlugin(); |
| 132 | + ... |
| 133 | + await _facesdkPlugin |
| 134 | + .setActivation( |
| 135 | + "Os8QQO1k4+7MpzJ00bVHLv3UENK8YEB04ohoJsU29wwW1u4fBzrpF6MYoqxpxXw9m5LGd0fKsuiK" |
| 136 | + "fETuwulmSR/gzdSndn8M/XrEMXnOtUs1W+XmB1SfKlNUkjUApax82KztTASiMsRyJ635xj8C6oE1" |
| 137 | + "gzCe9fN0CT1ysqCQuD3fA66HPZ/Dhpae2GdKIZtZVOK8mXzuWvhnNOPb1lRLg4K1IL95djy0PKTh" |
| 138 | + "BNPKNpI6nfDMnzcbpw0612xwHO3YKKvR7B9iqRbalL0jLblDsmnOqV7u1glLvAfSCL7F5G1grwxL" |
| 139 | + "Yo1VrNPVGDWA/Qj6Z2tPC0ENQaB4u/vXAS0ipg==") |
| 140 | + .then((value) => facepluginState = value ?? -1); |
| 141 | + ``` |
| 142 | + - Initialize the `FacesdkPlugin`: |
| 143 | + ```dart |
| 144 | + await _facesdkPlugin |
| 145 | + .init() |
| 146 | + .then((value) => facepluginState = value ?? -1) |
| 147 | + ``` |
| 148 | + - Set parameters using the `setParam` method: |
| 149 | + ```dart |
| 150 | + await _facesdkPlugin |
| 151 | + .setParam({'check_liveness_level': livenessLevel ?? 0}) |
| 152 | + ``` |
| 153 | + - Extract faces using the `extractFaces` method: |
| 154 | + ```dart |
| 155 | + final faces = await _facesdkPlugin.extractFaces(image.path) |
| 156 | + ``` |
| 157 | + - Calculate the similarity between faces using the `similarityCalculation` method: |
| 158 | + ```dart |
| 159 | + double similarity = await _facesdkPlugin.similarityCalculation( |
| 160 | + face['templates'], person.templates) ?? |
| 161 | + -1; |
| 162 | + ``` |
| 163 | +#### 2.2 FaceDetectionInterface |
| 164 | + To build the native camera screen and process face detection, please refer to the [lib/facedetectionview.dart](https://github.com/kby-ai/FaceRecognition-Flutter/blob/main/lib/facedetectionview.dart) file in the repository. |
| 165 | + |
| 166 | + This file contains the necessary code for implementing the camera screen and performing face detection. |
| 167 | + |
0 commit comments