Face Orientation Recognition

Capability Introduction

Human face detection, orientation determination

By detecting whether there is someone in the current camera view of a mobile phone and recognizing the orientation of the human face, important information can be provided for the smartphone's decision-making system, for example, in scenarios such as intelligent screen-on, intelligent screen-off, intelligent rotation, and image rotation control. Face orientation recognition devides the detective information on visible images into 5 categories, including upward-facing faces, right-facing faces, downward-facing faces, left-facing faces, and no face, by utilizing advanced image recognition technologies. The API obtains the specific face orientation category and degree of confidence.
Scenarios

Screen control, smart rotation

This API detects portrait and face orientation, and can be applied in functions that require advanced orientation, such as smart screen-on and screen-off, as well as smart image rotation.

Intelligent screen on/off

The phone screen automatically turns on if someone is in the front camera view; otherwise the screen will not turn on.

Smart rotation

When a phone is rotated, the screen rotates based on the orientation of the user's face, rather than based on the gravity sensor, for an improved user experience.

Description

Request
Copy

HeadposeDetector headposeDetector = new HeadposeDetector(mContext);
Frame frame = new Frame();
frame.setBitmap(mBitmap);
JSONObject jsonObject = headposeDetector.detect(frame, null);
HeadPoseResult result = headposeDetector.convertResult(jsonObject);

Response
Copy

{
  "resultCode":0,
  "headposevl":"{
    \"confidence\":0.99997175,
    \"headpose\":3
  }"
}
}

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 prepare() method directly use detect() method without calling the API?

Yes. In detect() method engine startup is in default. The engine will not start up again if started, please use with confidence.

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.

3Is the face orientation recognition algorithm on the device or in the cloud?

Face orientation detection is an on-device detection function. Users can still use this function when the mobile phone is disconnected from the network.

4What does "confidence" in the output refer to?

"Confidence" indicates the confidence level of the orientation, which is a floating number between 0 and 1. A larger value of confidence indicates a higher confidence level of the recognition result. Generally, a large threshold can be set, and a related decision is made only when the confidence exceeds that threshold.