Skip to content

MiniAiLive/FaceAttribute-Android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Face Attribute with Age, Gender and Other Properties

MiniAiLive Logo

Welcome to the MiniAiLive!

"This repository contains 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.. Feel free to use our MiniAI Face Attribute Android SDK."

Note

SDK is fully on-premise, processing all happens on hosting server and no data leaves server.

Latest SDK Download Here

MiniAI - Face Attribute (Android)

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

The repository 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 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.

This app integrates MiniAiLive's Premium Face Mobile SDK into the Android native platform.

  • Application ID: com.miniai.faceattribute

Features in this app

The home screen provides the following actions:

Action Description
Enroll Faces Register a person from a gallery image
Identify Faces Real-time 1:N face recognition from the camera
Auto Capture Automatic face capture gated by ROI + quality checks (front pose, occlusion, eye closure, mouth opening, anti-spoof)
Face Attribute Analyze a gallery image: liveness, quality, luminance, angles, occlusion, eye closure, mouth opening, age, gender
Settings Camera lens, liveness/identify thresholds, attribute thresholds, reset
About Us MiniAiLive contact info

SDK License

This app relies on MiniAiLive's Premium Face SDK, which requires a license bound to the application ID (com.miniai.faceattribute).

About SDK

1. Set up

  • Copy the SDK (libfacesdk folder) to the root folder in your project.

  • Add SDK to the project in settings.gradle.

    include ':libfacesdk'
  • Add dependency to your build.gradle.

    implementation project(path: ':libfacesdk')

16 KB page-size note: This build packages the native libraries uncompressed and 16 KB-aligned (useLegacyPackaging false) so the app supports 16 KB-page devices (Android 15+).

2. Initializing the SDK

  • Step One

    Activate the SDK using the license you 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.init(getAssets());

    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_closed, right_eye_closed
    Mouth opening (0 ~ 1) float mouth_opened
    Age, gender int age, gender
    68 points facial landmark float[] landmarks_68
  • 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 boolean check_liveness
    Check eye closure boolean check_eye_closeness
    Check face occlusion boolean check_face_occlusion
    Check mouth opening boolean check_mouth_opened
    Estimate age, gender boolean 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.

FaceSDK.faceDetection(bitmap, param)

This function requires two parameters: a Bitmap object and a FaceDetectionParam object that enables various processing functionalities. It returns a list of FaceBox objects.

- Create Templates

The FaceSDK provides a function that can generate a template from a Bitmap image. This template can then be used to verify the identity of the individual captured.

byte[] templates = FaceSDK.templateExtraction(bitmap, faceBox);

Takes a Bitmap object and a FaceBox object, and returns a byte array containing the template used for person verification.

- Calculate Similarity

The similarityCalculation function takes the byte arrays of two templates as parameters.

float similarity = FaceSDK.similarityCalculation(templates1, templates2);

It returns the similarity value between the two templates, used to determine the level of likeness between the two individuals.

- 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 converts them to Bitmap:

Bitmap bitmap = FaceSDK.yuv2Bitmap(nv21, image.getWidth(), image.getHeight(), 7);

The first parameter is an nv21 byte array containing the yuv data. The second and third parameters are the width and height of the yuv frame. The fourth parameter is the conversion mode, determined by the camera orientation.

Contact

For licensing and support, contact MiniAiLive:

About

This repository contains 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

 
 
 

Contributors