Face Attribute Recognition

Capability Introduction

Age, gender attributes, expressions, and wear

Face attributes are biological features that represent facial characteristics with strong inherent stability and individual variation, which are therefore useful for identifying individuals. Important variables include gender, skin tone, age, and expression. This API recognizes attributes of human faces in images input.
Scenarios

Feature identification, service recommendations

This API identifies multiple facial attributes, and can be applied in functions such as personalized beautification and precise product recommendation.

Personalized beautification

Allows for personalized beautification by gender. For example, male user faces are beautified to reflect strength and power, while female user faces are beautified for optimal delicacy.

Precise product recommendations

Recommends products to target users, based on demographic characteristics and usage preferences.

Description

Request
Copy

FaceAttributesDetector faceAttributes = new FaceAttributesDetector(mContext);
Frame frame = new Frame();
frame.setBitmap(mBitmap);
JSONObject jsonObject = faceAttributes.detectFaceAttributes(frame, null);
FaceAttributesInfo result = faceAttributes.convertResult(jsonObject);

Response
Copy

{
  "resultCode":0,
  "face_attributes":"{
    \"sex\":\"female\"
  }"
}

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.