Face detection is the process of automatically locating human faces in visual media (digital images or video). A face that is detected is reported at a position with an associated size and orientation. Once a face is detected, it can be searched for landmarks such as the eyes and nose.
Here are some of the terms that we use in discussing the face detection feature of ML Kit:
Face tracking extends face detection to video sequences. Any face appearing in a video for any length of time can be tracked. That is, faces that are detected in consecutive video frames can be identified as being the same person. Note that this is not a form of face recognition; this mechanism just makes inferences based on the position and motion of the faces in a video sequence.
A landmark is a point of interest within a face. The left eye, right eye, and base of the nose are all examples of landmarks. ML Kit provides the ability to find landmarks on a detected face.
Classification is determining whether a certain facial characteristic is present. For example, a face can be classified with regards to whether its eyes are open or closed. Another example is whether the face is smiling or not.
The following terms describe the angle a face is oriented with respect to the camera:
- Euler X: A face with a positive Euler X angle is facing upward.
- Euler Y: A face with a positive Euler Y angle is turned to the camera's right and to its left.
- Euler Z: A face with a positive Euler Z angle is rotated counter-clockwise relative to the camera.
ML Kit always reports the Euler Z angle of a detected face. The Euler Y angle is available only when using the "accurate" mode setting of the face detector (as opposed to the "fast" mode setting, which takes some shortcuts to make detection faster). The Euler X angle is not supported.
A landmark is a point of interest within a face. The left eye, right eye, and nose base are all examples of landmarks.
Rather than first detecting landmarks and using the landmarks as a basis of detecting the whole face, ML Kit detects the whole face independently of detailed landmark information. For this reason, landmark detection is an optional step that is not enabled by default.
The following table summarizes all of the landmarks that can be detected, for an associated face Euler Y angle:
|Euler Y angle||Detectable landmarks|
|< -36 degrees||left eye, left mouth, left ear, nose base, left cheek|
|-36 degrees to -12 degrees||left mouth, nose base, bottom mouth, right eye, left eye, left cheek, left ear tip|
|-12 degrees to 12 degrees||right eye, left eye, nose base, left cheek, right cheek, left mouth, right mouth, bottom mouth|
|12 degrees to 36 degrees||right mouth, nose base, bottom mouth, left eye, right eye, right cheek, right ear tip|
|> 36 degrees||right eye, right mouth, right ear, nose base, right cheek|
Each detected landmark includes its associated position in the image.
Classification determines whether a certain facial characteristic is present. ML Kit currently supports two classifications: eyes open and smiling.
Classification is expressed as a certainty value, indicating the confidence that the facial characteristic is present. For example, a value of 0.7 or more for the smiling classification indicates that it is likely that a person is smiling.
Both of these classifications rely upon landmark detection.
Also note that "eyes open" and "smiling" classification only works for frontal faces, that is, faces with a small Euler Y angle (at most about +/- 18 degrees).
Use face detection in your iOS or Android app: