This is a demo project that incorporates 3D passive face liveness detection, face recognition, face capture, and analysis of face attributes including age, gender, face quality, face occlusion, eye closure, and mouth opening.
This repository integrates several facial recognition
technologies, including 3D passive face liveness detection
, face recognition
, automatic face capture
, and analysis of various face attribute
s such as age
, gender
, face quality
, facial occlusion
, eye closure
, and mouth opening
.
The system utilizes Face Liveness Detection
technology to generate a real-time liveness score based on a single image captured by the camera.
Additionally, this demo offers Face Recognition
capabilities, enabling enrollment from a gallery and real-time identification of faces captured by the camera.
This repository features an automatic Face Capture
function that verifies various facial attributes
, such as face quality
, facial orientation
(yaw, roll, pitch), facial occlusion
(e.g., mask, sunglass, hand over face), eye closure
, mouth opening
, and the position of the face within the region of interest
(ROI
).
Moreover, the repository can compute scores for different face attributes from a gallery image, including liveness
, face orientation
(yaw, roll, pitch), face quality
, luminance of the face
, facial occlusion
, eye closure
, mouth opening
, age
, and gender
.
In this repository, we integrated
KBY-AI
’sPremium Face Mobile SDK
intoiOS
platform.
Basic | Standard | 🔽 Premium |
---|---|---|
Face Detection | Face Detection | Face Detection |
Face Liveness Detection | Face Liveness Detection | Face Liveness Detection |
Pose Estimation | 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 |
No. | Repository | SDK Details |
---|---|---|
1 | Face Liveness Detection - Android | Basic SDK |
2 | Face Liveness Detection - iOS | Basic SDK |
3 | Face Recognition - Android | Standard SDK |
4 | Face Recognition - iOS | Standard SDK |
5 | Face Recognition - Flutter | Standard SDK |
6 | Face Recognition - Ionic-Cordova | Standard SDK |
7 | Face Recognition - React-Native | Standard SDK |
8 | Face Attribute - Android | Premium SDK |
➡️ | Face Attribute - iOS | Premium SDK |
10 | Face Attribute - Flutter | Premium SDK |
To get
Face SDK(server)
, please visit products here.
The face attribute
project relies on KBY-AI
’s SDK, which requires a license for each bundle ID
from iOS
project.
The code below shows how to use the license: https://github.com/kby-ai/FaceAttribute-iOS/blob/3e377692dcd101067ba57033db8a43a84ceced28/FaceAttribute/ViewController.swift#L42-L51
To request a license, please contact us:
🧙Email:
[email protected]
🧙Telegram:
@kbyai
🧙WhatsApp:
+19092802609
🧙Skype:
live:.cid.66e2522354b1049b
🧙Facebook:
https://www.facebook.com/KBYAI
Copy the SDK
(facesdk.framework
folder) to the root
folder in your project.
Add SDK framework
to the project in Xcode
.
Project Navigator -> General -> Frameworks, Libraries, and Embedded Content
Project Navigator -> Build Settings -> Swift Compiler - General
Step One
To begin, you need to activate the SDK
using the license that you have received.
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.
FaceSDK.initSDK()
If initialization is successful, the return value will be SDK_SUCCESS
. Otherwise, an error value will be returned.
FaceBox
This class represents the output of the face detection function and can be utilized in template
creation functions.
Feature | Type | Name |
---|---|---|
Face rectangle | int | x1, y1, x2, y2 |
Face angles (-45 ~ 45) | float | yaw, roll, pitch |
Liveness score (0 ~ 1) | float | liveness |
Face quality (0 ~ 1) | float | face_quality |
Face luminance (0 ~ 255) | float | face_luminance |
Face occlusion (0 ~ 1) | float | face_occlusion |
Eye closure (0 ~ 1) | float | left_eye, right_eye |
Mouth opening (0 ~ 1) | float | face_mouth_opened |
Age, gender | int | age, gender |
68 points facial landmark | Data | landmark |
68 points facial landmark
FaceDetectionParam
This class serves as the input parameter for face detection
, enabling various processing functionalities such as face liveness detection
, eye closure checking
, facial occlusion checking
, mouth opening checking
, and age and gender estimation
.
Feature | Type | Name |
---|---|---|
Check liveness | bool | check_liveness |
Check eye closure | bool | check_eye_closeness |
Check face occlusion | bool | check_face_occlusion |
Check mouth opening | bool | check_mouth_opened |
Estimate age, gender | bool | estimate_age_gender |
The Face SDK
provides a unified function for detecting faces, enabling multiple functionalities such as liveness detection
, face orientation
(yaw, roll, pitch), face quality
, facial occlusion
, eye closure
, mouth opening
, age
, gender
, and facial landmarks
.
The function can be used as follows:
let faceBoxes = FaceSDK.faceDetection(image, param: param)
This function requires two parameters: a UIImage
object and a FaceDetectionParam
object that enables various processing functionalities.
The function returns a list of FaceBox
objects.
The FaceSDK
provides a function that can generate a template
from a UIImage
image. This template can then be used to verify the identity of the individual image captured.
let templates = FaceSDK.templateExtraction(image, faceBox: faceBox)
The SDK
’s template
extraction function takes two parameters: a UIImage
object and an object of FaceBox
.
The function returns a Data
, which contains the template
that can be used for person verification.
The similarityCalculation
function takes a byte array of two template
s as a parameter.
let similarity = FaceSDK.similarityCalculation(templates, templates2: personTemplates)
It returns the similarity value between the two templates, which can be used to determine the level of likeness between the two individuals.