Skip to content

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.

Notifications You must be signed in to change notification settings

kby-ai/FaceAttribute-iOS

Repository files navigation

πŸ“š Product & Resources - Here

πŸ›Ÿ Help Center - Here

πŸ’Ό KYC Verification Demo - Here

πŸ™‹β€β™€οΈ Docker Hub - Here

FaceAttribute-iOS

Overview

This repository integrates several facial recognition technologies, including 3D passive face liveness detection, face recognition, automatic face capture, and analysis of various face attributes 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's Premium Face Mobile SDK into iOS platform.

β—ΎFaceSDK(Mobile) Details

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

β—ΎFaceSDK(Mobile) Product List

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.

Download on the App Store

Screenshots

SDK License

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:

    var ret = FaceSDK.setActivation("lfjuQGclDc/ZKYfiW+llOq270U+RLDpq5qF0vhKCADayRQ+TlZvKOw9TiL3VRbkeTK7RiMbEp8UI" +
    "9OGBTyrQv3fHsOU/mAm437mzB5ozUTdxFkAR+OKEEA8ud8MPMCaIm87Exs579VARQATY1tXgoZ6J" +
    "OjYtNC6sAiZNOKnnOgSh17J46ilqmpts28wKleEjOqRB/lBctn8U7C65ULStUMFAIEnXPhG4s+jZ" +
    "FLxBklcrames8wqgW0syQlxvWgmWo5O0fTvCGXjSz5b+amfV9qpaUrkyznWwiK3VRuXUr/pzItrX" +
    "cfA85qwdaS8ysNQlKt6ld94eNI1x+50d5mnhEw==")
    if(ret == SDK_SUCCESS.rawValue) {
    ret = FaceSDK.initSDK()
    }

  • To request a license, please contact us:
    πŸ§™Email: [email protected]
    πŸ§™Telegram: @kbyai
    πŸ§™WhatsApp: +19092802609
    πŸ§™Skype: live:.cid.66e2522354b1049b
    πŸ§™Facebook: https://www.facebook.com/KBYAI

About SDK

1. Set up

  • 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

image

  • Add the bridging header to your project settings

Project Navigator -> Build Settings -> Swift Compiler - General

image

2. Initializing an SDK

  • 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.

3. SDK Classes

  • 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

4. SDK APIs

- Face Detection

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.

- Create Templates

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.

- Calculation similiarity

The similarityCalculation function takes a byte array of two templates 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.

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published