base on 3D passive face liveness detection, face anti-spoofing, face fraudulent check, face liveness check, face spoof detection, face fraud detection and face analysis on Android. <p align="center">
<a href="https://play.google.com/store/apps/dev?id=7086930298279250852" target="_blank">
<img alt="" src="https://github-production-user-asset-6210df.s3.amazonaws.com/125717930/246971879-8ce757c3-90dc-438d-807f-3f3d29ddc064.png" width=500/>
</a>
</p>
#### 🤗 Hugging Face - [Here](https://huggingface.co/kby-ai) <span> <img src="https://github.com/kby-ai/.github/assets/125717930/bcf351c5-8b7a-496e-a8f9-c236eb8ad59e" style="margin: 4px; width: 36px; height: 20px"> <span/>
#### 📚 Product & Resources - [Here](https://github.com/kby-ai/Product)
#### 🛟 Help Center - [Here](https://docs.kby-ai.com)
#### 💼 KYC Verification Demo - [Here](https://github.com/kby-ai/KYC-Verification-Demo-Android)
#### 🙋♀️ Docker Hub - [Here](https://hub.docker.com/u/kbyai)
# FaceLivenessDetection-Android
## Overview
This repository showcases real-time `Face Liveness Detection` technology on `Android` device.
> In this repository, we integrated KBY-AI's face liveness(face anti-spoofing) solution into Android platform.
### ◾FaceSDK(Mobile) Details
| 🔽Basic | Standard | Premium |
|------------------|------------------|------------------|
| <b>Face Detection</b> | Face Detection | Face Detection |
| <b>Face Liveness Detection</b> | Face Liveness Detection | Face Liveness Detection |
| <b>Pose Estimation</b> | Pose Estimation | Pose Estimation |
| | Face Recognition | Face Recognition |
| | | 68 points Face Landmark Detection |
| | | Face Quality Calculation |
| | | Face Occlusion Detection |
| | | Eye Closure Detection |
| | | Age, Gender Estimation |
### ◾FaceSDK(Mobile) Product List
| No. | Repository | SDK Details |
|------------------|------------------|------------------|
| ➡️ | <b>[Face Liveness Detection - Android](https://github.com/kby-ai/FaceLivenessDetection-Android)</b> | <b>Basic SDK</b> |
| 2 | [Face Liveness Detection - iOS](https://github.com/kby-ai/FaceLivenessDetection-iOS) | Basic SDK |
| 3 | [Face Recognition - Android](https://github.com/kby-ai/FaceRecognition-Android) | Standard SDK |
| 4 | [Face Recognition - iOS](https://github.com/kby-ai/FaceRecognition-iOS) | Standard SDK |
| 5 | [Face Recognition - Flutter](https://github.com/kby-ai/FaceRecognition-Flutter) | Standard SDK |
| 6 | [Face Recognition - Ionic-Cordova](https://github.com/kby-ai/FaceRececogniion-Ionic-Cordova) | Standard SDK |
| 7 | [Face Recognition - React-Native](https://github.com/kby-ai/FaceRecognition-React-Native) | Standard SDK |
| 8 | [Face Attribute - Android](https://github.com/kby-ai/FaceAttribute-Android) | Premium SDK |
| 9 | [Face Attribute - iOS](https://github.com/kby-ai/FaceAttribute-iOS) | Premium SDK |
| 10 | [Face Attribute - Flutter](https://github.com/kby-ai/FaceAttribute-Flutter) | Premium SDK |
> To get Face SDK(server), please visit products [here](https://github.com/kby-ai/Product).<br/>
## Try the APK
### Google Play
<a href="https://play.google.com/store/apps/details?id=com.kbyai.facelivedemo" target="_blank">
<img alt="" src="https://user-images.githubusercontent.com/125717930/230804673-17c99e7d-6a21-4a64-8b9e-a465142da148.png" height=80/>
</a>
## Performance Video
You can visit our YouTube video [here](https://www.youtube.com/watch?v=F7c5ZqtbIsA) to see how well our demo app works.</br></br>
[![Face Recognition Android](https://img.youtube.com/vi/F7c5ZqtbIsA/0.jpg)](https://www.youtube.com/watch?v=F7c5ZqtbIsA)
## SDK License
This project uses `KBY-AI`'s liveness detection SDK. The SDK requires a license per `application ID`.
- The code below shows how to use the license: https://github.com/kby-ai/FaceLivenessDetection-Android/blob/f81f001b0a2f65330d2adaabc9b001003af9a112/app/src/main/java/com/kbyai/facelivedemo/CameraActivity.java#L69-L77
- To request a license, please contact us:</br>
🧙`Email:`
[email protected]</br>
🧙`Telegram:` [@kbyai](https://t.me/kbyai)</br>
🧙`WhatsApp:` [+19092802609](https://wa.me/+19092802609)</br>
🧙`Skype:` [live:.cid.66e2522354b1049b](https://join.skype.com/invite/OffY2r1NUFev)</br>
🧙`Facebook:` https://www.facebook.com/KBYAI</br>
## About SDK
### Set up
1. Copy the SDK (`libfacesdk` folder) to the `root` folder in your project.
2. Add SDK to the project in `settings.gradle`.
```kotlin
include ':libfacesdk'
```
3. Add dependency to your `build.gradle`.
```kotlin
implementation project(path: ':libfacesdk')
```
### Initializing an SDK
- Step One
To begin, you need to activate the SDK using the license that you have received.
```kotlin
FaceSDK.setActivation("...")
```
If activation is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned.
- Step Two
After activation, call the SDK's initialization function.
```kotlin
FaceSDK.init(getAssets());
```
If initialization is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned.
### Face Detection and Liveness Detection
The `FaceSDK` offers a single function for detecting face and liveness detection, which can be used as follows:
```kotlin
FaceSDK.faceDetection(bitmap)
```
This function takes a single parameter, which is a `bitmap` object. The return value of the function is a list of `FaceBox` objects. Each FaceBox object contains the detected face rectangle, liveness score, and facial angles such as `yaw`, `roll`, and `pitch`.
### Yuv to Bitmap
The SDK provides a function called `yuv2Bitmap`, which converts a `yuv` frame to a `bitmap`. Since camera frames are typically in `yuv` format, this function is necessary to convert them to `bitmap`. The usage of this function is as follows:
```kotlin
Bitmap bitmap = FaceSDK.yuv2Bitmap(nv21, image.getWidth(), image.getHeight(), 7);
```
The first parameter is an `nv21` byte array containing the `yuv` data.
The second parameter is the width of the `yuv` frame, and the third parameter is its height.
The fourth parameter is the `conversion mode`, which is determined by the camera orientation.
To determine the appropriate `conversion mode`, the following method can be used:
```kotlin
1 2 3 4 5 6 7 8
888888 888888 88 88 8888888888 88 88 8888888888
88 88 88 88 88 88 88 88 88 88 88 88
8888 8888 8888 8888 88 8888888888 8888888888 88
88 88 88 88
88 88 888888 888888
```
", Assign "at most 3 tags" to the expected json: {"id":"8426","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"