Facial Comparison - Face Similarity Online- HUAWEI Developer

Capability Introduction

Landmark extraction, precise comparison

This API recognizes and extracts key facial features, performs high-precision comparisons of human faces, provides confidence scores, and determines whether the same person appears across different images. Cutting-edge facial comparison technology intelligently categorizes and manages photos. An intelligent image recognition algorithm ensures accurate facial recognition, and enables apps to provide an enhanced user experience.
Scenarios

Similarity comparison, identity authentication

This API performs high-precision facial comparisons, and can be applied in functions related face similarity, such as image management, face similarity comparisons, and identity authentication.

Automatic photo classification in gallery

Intelligently classifies photos in Gallery, based on the face comparison function.

Facial similarity comparisons

This function can be used to match a user's face with that of a similar-looking celebrity.

Description

Request
Copy

FaceComparator faceComparator= new FaceComparator(getApplicationContext());
Frame frame1 = new Frame();
frame1.setBitmap(mBitmapPerson1);
Frame frame2 = new Frame();
frame2.setBitmap(mBitmapPerson2);

JSONObject jsonObject = faceComparator.faceCompare(frame1, frame2, null);

Response
Copy

{
  "resultCode": 0,
  "faceCompare": {
    "isSamePerson": true,
    "score": 0.75659186
  }
}

Start development here with Huawei

Service introduction

Service overview, application scenarios, and functions
Learn more

Access preparation

Preparation for access, such as registration, authentication, and agreement signing
Learn more

Sample code

Demonstration of sample code
Learn more

API description

Interface parameter definition, description, restrictions, and constraints
Learn more
FAQ
1Can I call the faceCompare() method without calling the prepare() method of the API?

Yes, you can. The engine is started by default in the faceCompare() method. If the engine has already been started, it will not restart.

2When should I call the release() method?

The release() method will uninstall a model that has been loaded to the NPU chip. If the app is no longer using face detection, uninstall the model in a timely manner to free up resources.