DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • AI-Based Threat Detection in Cloud Security
  • Hybrid Cloud vs Multi-Cloud: Choosing the Right Strategy for AI Scalability and Security
  • AI Protection: Securing The New Attack Frontier
  • Safeguarding Sensitive Data: Content Detection Technologies in DLP

Trending

  • The 4 R’s of Pipeline Reliability: Designing Data Systems That Last
  • AI's Dilemma: When to Retrain and When to Unlearn?
  • Unlocking AI Coding Assistants Part 2: Generating Code
  • Breaking Bottlenecks: Applying the Theory of Constraints to Software Development
  1. DZone
  2. Data Engineering
  3. AI/ML
  4. How AI Is Used in Static Biometric Verification

How AI Is Used in Static Biometric Verification

This article outlines the technical principles behind static biometric verification and its use cases, as well as how to implement a liveness detection service in an app.

By 
Jackson Jiang user avatar
Jackson Jiang
DZone Core CORE ·
Mar. 31, 22 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
7.6K Views

Join the DZone community and get the full member experience.

Join For Free

Static biometric verification is a commonly used AI feature that captures faces in real time and can determine whether a face belongs to a real person or not, without prompting the user to move their head or face. In this way, the service helps deliver a convenient user experience that wins positive feedback.

Technical Principles

Static biometric verification requires an RGB camera and is able to differentiate between a real person's face and a spoof attack (such as an image or screenshot of a face and a face mask), through details (such as the moiré pattern or reflection on a paper photo) in the image captured by the camera. The service supports data from a wide array of scenarios, including different lighting conditions, face accessories, genders, hairstyles, and mask materials. The service analyzes a face's surroundings to detect suspicious environments. 

The static biometric verification model adopts the lightweight convolutional module, and linear computation is converted to a single convolutional module or a fully connected layer in the inference phase through reparameterization. The MindSpore Lite inference framework can be used for model deployment, which crops operators. The model's package size is then shrunk, making it more convenient for integration.

Application Scenarios

Liveness detection is usually used before face verification. For example, when a user uses facial recognition to unlock their phone, liveness detection first determines whether the captured face is real or not. If yes, face verification will then check whether the face matches the one recorded in the system. These two technologies complement one another to protect a user's device from unauthorized access.

So it's safe to say that static biometric verification provides rigid protection for apps, and I'm here to illustrate how this can be integrated.

Integration Procedure

Preparations

The detailed preparations are all provided in the documentation for the service.

Two modes are available to call the service:

Call Mode

Liveness Detection Process

Liveness Detection UI

Function

Default View Mode

Processed by ML Kit

Provided

Determines whether a face is real or not.

Customized View Mode

Processed by ML Kit

Custom

Determines whether a face is real or not.

Default View Mode

1. Create a callback to obtain the static biometric verification result.

Java
 
private MLLivenessCapture.Callback callback = new MLLivenessCapture.Callback() {
    @Override
    public void onSuccess(MLLivenessCaptureResult result) {
        // Callback when verification is successful. The result indicates whether the face is of a real person.
    }

    @Override
    public void onFailure(int errorCode) {
        // Callback when verification fails. For example, the camera is abnormal (CAMERA_ERROR). Add the processing logic to deal with the failure.
    }
};

2. Create a static biometric verification instance and start verification.

Java
 
MLLivenessCapture capture = MLLivenessCapture. getInstance();
capture.startDetect(activity, callback);

Customized View Mode

1. Create an MLLivenessDetectView instance and load it to the activity layout.

Java
 
/**
* i. Bind the camera preview screen to the remote view and set the liveness detection area.
* In the camera preview stream, static biometric verification determines whether a face is in the middle of the image. To improve the pass rate, you are advised to place the face frame in the middle of the screen and set the liveness detection area to be slightly larger than the face frame.
* ii. Set whether to detect the mask.
* iii. Set the result callback.
* iv. Load MLLivenessDetectView to the activity.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_liveness_custom_detection);
    mPreviewContainer = findViewById(R.id.surface_layout);
    // ObtainLLivenessDetectView
mlLivenessDetectView = new MLLivenessDetectView.Builder()
        .setContext(this)
        // Set whether to detect the mask.
        .setOptions(MLLiveness DetectView.DETECT_MASK)
        // Set the rectangle of the face frame relative to MLLivenessDetectView.
        .setFaceRect(new Rect(0, 0, 0, 200))
        // Set the result callback.
        .setDetectCallback(new OnMLLivenessDetectCallback() {
            @Override
            public void onCompleted(MLLivenessCaptureResult result) {
                // Callback when verification is complete.
            }

            @Override
            public void onError(int error) {
                // Callback when an error occurs during verification.
            }

            @Override
            public void onInfo(int infoCode, Bundle bundle) {
                // Callback when the verification prompt message is received. This message can be displayed on the UI.
                // if(infoCode==MLLivenessDetectInfo.NO_FACE_WAS_DETECTED){
                     // No face is detected.
                // }
                // ...
            }

            @Override
            public void onStateChange(int state, Bundle bundle) {
                // Callback when the verification status changes.
                // if(state==MLLivenessDetectStates.START_DETECT_FACE){
                     // Start face detection.
                // }
                // ...
            }
        }).build();
    mPreviewContainer.addView(mlInteractiveLivenessDetectView);
    mlInteractiveLivenessDetectView.onCreate(savedInstanceState);
}

2. Set a lifecycle listener for MLLivenessDetectView.

Java
 
@Override
protected void onDestroy() {
    super.onDestroy();
    mlLivenessDetectView.onDestroy();
}

@Override
protected void onPause() {
    super.onPause();
    mlLivenessDetectView.onPause();
}

@Override
protected void onResume() {
    super.onResume();
    mlLivenessDetectView.onResume();
}

@Override
protected void onStart() {
    super.onStart();
    mlLivenessDetectView.onStart();
}

@Override
protected void onStop() {
    super.onStop();
    mlLivenessDetectView.onStop();
}


AI security

Published at DZone with permission of Jackson Jiang. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • AI-Based Threat Detection in Cloud Security
  • Hybrid Cloud vs Multi-Cloud: Choosing the Right Strategy for AI Scalability and Security
  • AI Protection: Securing The New Attack Frontier
  • Safeguarding Sensitive Data: Content Detection Technologies in DLP

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!