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

johndev8964/FaceAttribute-iOS

 
 

Repository files navigation

Nest Logo

FaceAttribute-iOS

Introduction

This demo project 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, the demo offers Face Recognition capabilities, enabling enrollment from a gallery and real-time identification of faces captured by the camera.

The demo also 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 demo 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.

⭐ ⭐ ⭐ Do not forget to star (Top right of this page) it if you like this repo ⭐ ⭐ ⭐

The demo is integrated with KBY-AI's Premium Face SDK.

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

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.

About SDK

1. Set up

  • Copy the SDK (facesdk.framework folder) to the root folder of 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 captured in the image.

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 97.9%
  • Objective-C 2.1%