Get Started
Face Detection
On this page
  1. Commands
  2. Settings
  3. Output Variables
  4. JSON Output

Face Detection

Detects human faces in real time from the camera video and tracks their positions. Includes emotion recognition and age and gender estimation.

Commands

CommandDescription
Face Detected?Checks whether a face is detected.
Count FacesWrites the number of detected faces.
Get FaceWrites the confidence, center point, and width and height of one face chosen by Select By.
Get All FacesWrites every detected face as JSON.
Recognize EmotionWhen a face is detected, analyzes the expression and classifies it into one of 8 emotions.
Estimate Age/GenderEstimates the age and gender of the detected face.

When a Detection Zone is set, only faces inside it are considered.

Settings

SettingDescription
Confidence (%)Default 70.
Detection ZoneSee Common Items.
Select ByHighest Confidence (default), By Confidence Index (0-based), Largest Size, Closest From Ref. Point.
Index (0-based)0 to 15, default 0.
Reference PointSee Common Items.

Output Variables

FieldTypeValue
DetectedDigitalTrue when a face is detected.
CountNumberNumber of detected faces.
Confidence (%)NumberConfidence of the selected face, 0 to 100.
Center Point X / Center Point YNumberPixel coordinates of the selected face's center.
Width (Pixels) / Height (Pixels)NumberSize of the selected face's box.
Output (JSON Text)TextArray of every detected face.
EmotionTextEnglish name of the recognized emotion; none when not detected.
Emotion IDNumberEmotion number 0 to 7; -1 when not detected.
Emotion Confidence (%)Number0 to 100; -1 when not detected.
AgeNumberEstimated age 0 to 100; -1 when not detected.
GenderTextmale or female; none when not detected.
Gender Confidence (%)Number0 to 100; -1 when not detected.

JSON Output

Each face carries score (confidence, 0 to 100), bbox, center, width, and height. The emotion keys (emotion, emotion_id, emotion_confidence) are present only while Recognize Emotion runs, and the age and gender keys (age, gender, gender_confidence) only while Estimate Age/Gender runs. Note that the confidence key is score, unlike confidence in Object Detection.

[
  {
    "score": 95,
    "bbox": { "x1": 120, "y1": 80, "x2": 250, "y2": 300 },
    "center": { "x": 185, "y": 190 },
    "width": 130,
    "height": 220,
    "emotion": "happy",
    "emotion_id": 4,
    "emotion_confidence": 87,
    "age": 28,
    "gender": "male",
    "gender_confidence": 92
  }
]
The 8 emotions and their IDs
IDEmotionMeaning
0angryAnger
1contemptContempt
2disgustDisgust
3fearFear
4happyHappiness
5neutralNeutral
6sadSadness
7surpriseSurprise