5 Face Detection Quickstart Guide
This page provides a comprehensive guide to how you can quickly use the face detection function in Mercury Cloud.
The Face Detection API detects faces in images and returns rectangle coordinates representing the locations of the faces. The API also extracts several face-related attributes, such as face angle, gender, age, emotion, etc. All attributes are predicted by AI algorithms, not actual classification.
The following steps upload a single image and detect faces within the images. When detected successfully, the system returns the detected face information.
5.1 Preparation
To start, make sure you have a Python environment installed.
Download and copy the following Python files to your Python path folder.
Open the api_parameters.py
with a text editor and replace the following parameters will your info. Refer to Section 3.2 for more details.
5.2 Send a face detection request
Try the following command to send an API call of Face Detection to detect faces in that image. Replace the path with your Python library path and target image file path, respectively.
The result would be shown as follows. It includes a detection results
field that shows whether a face has been detected and detected face details.
Here,HAT_STYLE_TYPE_NONE
means the face detected is not wearing a hat/cap.
TRANSPARENT_GLASSES
means the face detected is wearing a pair of normal glasses (not sunglasses).
COLOR_TYPE_NONE
means that the face detected is not wearing a mask.
For more details on attributes information, refer to the latest version YAML file or online API manual provided in Chapter 2.
Table: Attributes
Last updated