Face Age

Analyzes and predicts the age of a face in a video stream. The face age is predicted within an age range. The event listener continuously obtains the data in a JSON object as FaceAI analyzes the age of a face. If the prediction quality is poor, the event is not issued.

Method

To analyze and predict face age in a video stream.

Method: EnxFaceAI.startFaceAge(callback)

Parameter

  • callback: Callback to know that processing request has been accepted.

Event Listener

  • face-age: This event notification is received repeatedly with the Face Age Analysis report as a JSON object.

JSON Object: Received with Face Age Analysis data.

{ output: {
age: {
-18: Number,
18-35: Number,
35-51: Number,
51-: Number
},
numericAge: Number
}
}

Analysis Data Explanation

  • output : Face Age Analysis Report
    • age : Filtered (smoothened) age prediction:
      • -18 : Probability Weightage suggesting less than 18 years old.
      • 18-35 : Probability Weightage suggesting between 18 to 35 years old.
      • 35-51 : Probability Weightage suggesting between 18 35 years old.
      • 51- : Probability Weightage suggesting equal or greater than 51 years old.
    • numericAge : Numeric. Estimated Age

Note: In case of poor quality of the prediction, the event is not fired (that is, it is skipped for the specified frame).

Sample Code

// Start Face Age
faceAI.startFaceAge((res) => {
if (res.result === 0) {
window.addEventListener("face-age", (evt) => {
console.log(evt.detail, "face-age");
});
}
});