|
1 | | -# Face-Active-Liveness-Detection-Android |
| 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 | +### Our facial recognition algorithm is globally top-ranked by NIST in the FRVT 1:1 leaderboards.<span> <img src="https://github.com/kby-ai/.github/assets/125717930/bcf351c5-8b7a-496e-a8f9-c236eb8ad59e" style="margin: 4px; width: 36px; height: 20px"> <span/> </br> ([Latest NIST frvt evaluation report 2024-12-20](https://pages.nist.gov/frvt/html/frvt11.html)) </br> |
| 8 | + |
| 9 | + |
| 10 | +#### 🆔 ID Document Liveness Detection - Linux - [Here](https://web.kby-ai.com) <span> <img src="https://github.com/kby-ai/.github/assets/125717930/bcf351c5-8b7a-496e-a8f9-c236eb8ad59e" style="margin: 4px; width: 36px; height: 20px"> <span/> |
| 11 | +#### 🤗 Hugging Face - [Here](https://huggingface.co/kby-ai) |
| 12 | +#### 📚 Product & Resources - [Here](https://github.com/kby-ai/Product) |
| 13 | +#### 🛟 Help Center - [Here](https://docs.kby-ai.com) |
| 14 | +#### 💼 KYC Verification Demo - [Here](https://github.com/kby-ai/KYC-Verification-Demo-Android) |
| 15 | +#### 🙋♀️ Docker Hub - [Here](https://hub.docker.com/u/kbyai) |
| 16 | + |
| 17 | +# FaceActiveLivenessDetection-Android |
| 18 | + |
| 19 | +## Overview |
| 20 | +This repository showcases real-time `Face Liveness Detection` technology on `Android` device. |
| 21 | + |
| 22 | +> In this repository, we integrated KBY-AI's face liveness(face anti-spoofing) solution into Android platform. |
| 23 | +
|
| 24 | +### ◾FaceSDK(Mobile) Details |
| 25 | + |
| 26 | + | 🔽Basic | Standard | Premium | |
| 27 | + |------------------|------------------|------------------| |
| 28 | + | <b>Face Detection</b> | Face Detection | Face Detection | |
| 29 | + | <b>Face Liveness Detection</b> | Face Liveness Detection | Face Liveness Detection | |
| 30 | + | <b>Pose Estimation</b> | Pose Estimation | Pose Estimation | |
| 31 | + | | Face Recognition | Face Recognition | |
| 32 | + | | | 68 points Face Landmark Detection | |
| 33 | + | | | Face Quality Calculation | |
| 34 | + | | | Face Occlusion Detection | |
| 35 | + | | | Eye Closure Detection | |
| 36 | + | | | Age, Gender Estimation | |
| 37 | + |
| 38 | +### ◾FaceSDK(Mobile) Product List |
| 39 | + | No. | Repository | SDK Details | |
| 40 | + |------------------|------------------|------------------| |
| 41 | + | ➡️ | <b>[Face Liveness Detection - Android](https://github.com/kby-ai/FaceLivenessDetection-Android)</b> | <b>Basic SDK</b> | |
| 42 | + | 2 | [Face Liveness Detection - iOS](https://github.com/kby-ai/FaceLivenessDetection-iOS) | Basic SDK | |
| 43 | + | 3 | [Face Recognition - Android](https://github.com/kby-ai/FaceRecognition-Android) | Standard SDK | |
| 44 | + | 4 | [Face Recognition - iOS](https://github.com/kby-ai/FaceRecognition-iOS) | Standard SDK | |
| 45 | + | 5 | [Face Recognition - Flutter](https://github.com/kby-ai/FaceRecognition-Flutter) | Standard SDK | |
| 46 | + | 6 | [Face Recognition - Ionic-Cordova](https://github.com/kby-ai/FaceRececogniion-Ionic-Cordova) | Standard SDK | |
| 47 | + | 7 | [Face Recognition - React-Native](https://github.com/kby-ai/FaceRecognition-React-Native) | Standard SDK | |
| 48 | + | 8 | [Face Attribute - Android](https://github.com/kby-ai/FaceAttribute-Android) | Premium SDK | |
| 49 | + | 9 | [Face Attribute - iOS](https://github.com/kby-ai/FaceAttribute-iOS) | Premium SDK | |
| 50 | + | 10 | [Face Attribute - Flutter](https://github.com/kby-ai/FaceAttribute-Flutter) | Premium SDK | |
| 51 | + |
| 52 | +> To get Face SDK(server), please visit products [here](https://github.com/kby-ai/Product).<br/> |
| 53 | +## Try the APK |
| 54 | + |
| 55 | +### Google Play |
| 56 | + |
| 57 | +<a href="https://play.google.com/store/apps/details?id=com.kbyai.facelivedemo" target="_blank"> |
| 58 | + <img alt="" src="https://user-images.githubusercontent.com/125717930/230804673-17c99e7d-6a21-4a64-8b9e-a465142da148.png" height=80/> |
| 59 | +</a> |
| 60 | + |
| 61 | +## Performance Video |
| 62 | + |
| 63 | +You can visit our YouTube video [here](https://www.youtube.com/watch?v=F7c5ZqtbIsA) to see how well our demo app works.</br></br> |
| 64 | +[](https://www.youtube.com/watch?v=F7c5ZqtbIsA) |
| 65 | + |
| 66 | +## SDK License |
| 67 | + |
| 68 | +This project uses `KBY-AI`'s liveness detection SDK. The SDK requires a license per `application ID`. |
| 69 | + |
| 70 | +- 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 |
| 71 | + |
| 72 | +- To request a license, please contact us:</br> |
| 73 | +🧙`Email:` contact@kby-ai.com</br> |
| 74 | +🧙`Telegram:` [@kbyai](https://t.me/kbyai)</br> |
| 75 | +🧙`WhatsApp:` [+19092802609](https://wa.me/+19092802609)</br> |
| 76 | +🧙`Skype:` [live:.cid.66e2522354b1049b](https://join.skype.com/invite/OffY2r1NUFev)</br> |
| 77 | +🧙`Facebook:` https://www.facebook.com/KBYAI</br> |
| 78 | + |
| 79 | +## About SDK |
| 80 | + |
| 81 | +### Set up |
| 82 | +1. Copy the SDK (`libfacesdk` folder) to the `root` folder in your project. |
| 83 | + |
| 84 | +2. Add SDK to the project in `settings.gradle`. |
| 85 | +```kotlin |
| 86 | +include ':libfacesdk' |
| 87 | +``` |
| 88 | + |
| 89 | +3. Add dependency to your `build.gradle`. |
| 90 | +```kotlin |
| 91 | +implementation project(path: ':libfacesdk') |
| 92 | +``` |
| 93 | + |
| 94 | +### Initializing an SDK |
| 95 | + |
| 96 | +- Step One |
| 97 | + |
| 98 | +To begin, you need to activate the SDK using the license that you have received. |
| 99 | +```kotlin |
| 100 | +FaceSDK.setActivation("...") |
| 101 | +``` |
| 102 | + |
| 103 | +If activation is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned. |
| 104 | + |
| 105 | +- Step Two |
| 106 | + |
| 107 | +After activation, call the SDK's initialization function. |
| 108 | +```kotlin |
| 109 | +FaceSDK.init(getAssets()); |
| 110 | +``` |
| 111 | +If initialization is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned. |
| 112 | + |
| 113 | +### Face Detection and Liveness Detection |
| 114 | + |
| 115 | +The `FaceSDK` offers a single function for detecting face and liveness detection, which can be used as follows: |
| 116 | +```kotlin |
| 117 | +FaceSDK.faceDetection(bitmap) |
| 118 | +``` |
| 119 | + |
| 120 | +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`. |
| 121 | + |
| 122 | +### Yuv to Bitmap |
| 123 | +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: |
| 124 | +```kotlin |
| 125 | +Bitmap bitmap = FaceSDK.yuv2Bitmap(nv21, image.getWidth(), image.getHeight(), 7); |
| 126 | +``` |
| 127 | +The first parameter is an `nv21` byte array containing the `yuv` data. |
| 128 | + |
| 129 | +The second parameter is the width of the `yuv` frame, and the third parameter is its height. |
| 130 | + |
| 131 | +The fourth parameter is the `conversion mode`, which is determined by the camera orientation. |
| 132 | + |
| 133 | +To determine the appropriate `conversion mode`, the following method can be used: |
| 134 | +```kotlin |
| 135 | + 1 2 3 4 5 6 7 8 |
| 136 | + |
| 137 | + 888888 888888 88 88 8888888888 88 88 8888888888 |
| 138 | + 88 88 88 88 88 88 88 88 88 88 88 88 |
| 139 | + 8888 8888 8888 8888 88 8888888888 8888888888 88 |
| 140 | + 88 88 88 88 |
| 141 | + 88 88 888888 888888 |
| 142 | +``` |
| 143 | + |
0 commit comments