FaceAISDK Android Documentation

repository·master·Indexed 22 days ago

https://github.com/faceaisdk/faceaisdk_android

An offline, on-device Android SDK for face detection, recognition, liveness detection, and 1:N/M:N face searching. Designed for privacy-conscious applications, it processes all data locally without cloud dependency. Key features include action and silent liveness detection, support for system and UVC protocol USB cameras, and specialized modes for 1:1 verification and 1:N/M:N identification.

Tokens
5K
Snippets
5
Records
27
Agent score
78%

What's inside FaceAISDK

  1. Overview of FaceAISDK for Android

    master

    FaceAISDK is an on-device, offline SDK for Android (supporting versions 8 to 16) that provides high-performance facial analysis capabilities. It is designed for privacy and cost-efficiency because all inference occurs locally on the device without uploading sensitive facial data to the cloud.

    Core Capabilities:

    • Face Detection & Recognition: Identifying and verifying faces.
    • Liveness Detection (Anti-Spoofing): Supports silent liveness detection and action-based liveness (mouth opening, smiling, blinking, shaking head, nodding).
    • Face Search: Supports 1:N and M:N face searching.
    • Hardware Support: Works with standard system cameras (phones/tablets) and UVC-protocol USB cameras.

    Key Benefits:

    • Data Security: Local execution ensures no user data is sent to the cloud.
    • Offline Capability: Functions without any network connection.
    • Cost Savings: Reduces cloud computing expenses by running machine learning on the edge.
  2. FaceAISDK Core Capabilities and Use Cases

    master

    FaceAISDK provides an entirely offline, on-device implementation for face-related tasks, ensuring data privacy as no data is uploaded or stored.

    Supported Features

    • Face Detection & Recognition
    • Liveness Detection: Supports both silent liveness and action liveness (e.g., mouth opening, smiling, blinking, head shaking, head nodding).
    • Face Search: Supports 1:N and M:N search scenarios.
    • Hardware Support: Works with standard system cameras and UVC protocol USB cameras (requires WDR > 105dB for clear imaging).

    Common Scenarios

    • 1:1 Verification: Mobile attendance, password-less login, face authorization, face unlock, and patrol check-in.
    • 1:N Search: Residential/company access control, smart locks, smart campus, robots, smart home, and hotels.
  3. Choose a 1:N Face Recognition mode

    master

    The 1:N mode is used to identify an individual within a larger database. The system captures a photo and searches the entire face database to find a match, answering the question "Who am I?" or "Am I in the database?". This is a search-and-match process.

    Common Use Cases:

    • Residential access control (community gates)
    • Corporate access control (office gates)
    • Smart door locks
    • Public attendance/clock-in machines
  4. Choose an M:N Face Recognition mode

    master

    The M:N mode involves identifying all faces present in a scene and comparing them against a face database.

    Note: This mode is technically demanding. Due to the large number of subjects, sub-optimal face angles, and environmental factors affecting image capture, M:N mode may have a higher error rate compared to 1:1 or 1:N modes.

  5. Understand the FaceSDKLib Module Structure

    master

    The FaceSDKLib module serves as a demonstration container for all SDK features. The project is organized into the following functional modules:

    ModuleDescription
    verify1:1 face detection, recognition, liveness detection pages, and static face comparison.
    search1:N face search/recognition and face database management (add/delete/update).
    addFaceCommon utility for 1:1 and 1:N workflows to add faces and extract facial features via the SDK camera.
    SysCameraUses the built-in system camera of phones or tablets.
    UVCCameraUses UVC-protocol USB cameras (typically custom hardware).
  6. Privacy and Data Security of FaceAI SDK

    master

    The FaceAI SDK is designed for on-device, offline processing on Android. All core functionalities—including Face Detection, Recognition, Liveness Detection, Anti-Spoofing, and 1:N Face Search—are executed locally on the terminal.

    Key privacy features:

    • Offline Processing: All processing is performed on-device without an internet connection.
    • No Data Collection: The SDK does not collect or upload sensitive facial data or personal information to any server.
    • Local Execution: The SDK is responsible only for detection, comparison, and recognition processes locally.
  7. Data collection and processing behavior of FaceAISDK

    master

    The FaceAISDK is designed for offline operation. Authorization and normal functioning do not require internet connectivity. All information is processed locally and cached within the host application's private directory.

    Collected Information Types:

    TypePurposeProcessing Method
    Device ModelTo judge hardware configuration and dynamically adjust engine parametersLocal processing only; no collection or reporting
    OS VersionTo handle compatibility and prevent usage anomaliesLocal processing only; no collection or reporting
    Face Feature ValuesUsed for face recognition, liveness detection, and registration/collection of face dataLocal processing within the SDK
  8. Supported Camera Types and Hardware Requirements

    master

    The SDK does not restrict specific camera types but currently supports:

    • System
    • UVC_RGB
    • UVC_RGB_IR

    Implementation Notes

    • Camera Management: You must manage the camera based on your hardware platform's characteristics. The Demo provides a default FaceCameraXFragment, but you can also use camera1 to manage system cameras.
    • External Cameras: Using external cameras (UVC) may result in lower performance (frame rate, latency, buffer handling) compared to built-in cameras and is more susceptible to connection stability and bandwidth issues.
    • Recommended Hardware: It is recommended to use devices with HARDWARE_LEVEL_FULL or HARDWARE_LEVEL_3 levels.
    • Imaging Requirements: For optimal performance, use a camera with a wide dynamic range (WDR) greater than 105dB (or 120dB for outdoor use). In dark environments, a fill light must be configured.
  9. Understand the FaceAISDK Project Structure

    master

    The SDK is organized into several modules based on functionality and camera type:

    • FaceSDKLib: A sub-module containing demonstrations of all FaceAISDK features.
    • verify: Handles 1:1 face detection, recognition, liveness detection, and static face comparison.
    • search: Handles 1:N face search and recognition, including face library management (CRUD operations).
    • addFace: A shared component used by both 1:1 and 1:N workflows to add faces and extract feature vectors using the SDK camera.
    • SysCamera: Implementation for system cameras (standard phone/tablet cameras) that works immediately upon opening.
    • UVCCamera: Implementation for UVC protocol USB cameras, typically used for custom hardware integration.
  10. Choose a 1:1 Face Authentication mode

    master

    The 1:1 mode is used for identity verification to prove that a person is who they claim to be. It performs a static comparison between the current face being captured and a specific reference image from a database.

    Common Use Cases:

    • App attendance/clock-in
    • Password-less login
    • Face-based authorization
    • Face unlocking applications
  11. Select a Liveness Detection method

    master

    Liveness detection ensures the subject is a real person and not a photo or video. The SDK supports four primary methods:

    1. Action Liveness Detection (动作活体检测): Requires the user to perform random combinations of actions such as opening their mouth, smiling, blinking, shaking their head, or nodding.
    2. Silent Liveness Detection (静默活体检测): Detects printed photos or screen images by analyzing camera input for paper edges or moiré patterns. This requires high-quality camera imaging capabilities.
    3. Infrared Liveness Detection (红外活体检测): Requires hardware support from an infrared (IR) camera.
    4. Colorful/Spectral Liveness Detection (炫彩活体检测): Models and compares how light reflects off the face to ensure the subject is a real human.
  12. Configure Silent Liveness Detection Thresholds

    master

    Silent liveness detection uses a threshold range between 0.85 and 0.95.

    Actual performance is highly dependent on the camera hardware and environmental lighting. If your application supports a variety of different camera types, it is recommended to start with a lower threshold and then dynamically adjust the threshold for each specific camera type based on data analysis.