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 data in a JSON object as FaceAI analyzes the age of a face. If the prediction quality is poor, the event is not issued.

Methods

  • EnxFaceAI.startFaceAge(config, callback) : To analyze and predict face age in a video stream.
  • EnxFaceAI.stopFaceAge(callback) : To stop analyzing and predicting face age in a video stream.

Parameters

For Method: EnxFaceAI.startFaceAge(config, callback)

  • config : JSON Object. This is to configure or customize parameter using which the Face Age would be analyzed.
    • Currently EnableX doesn’t have any parameter. Therefore, you need to keep it empty while calling this method.
  • callback : Callback to know that processing request has been accepted.

For Method: EnxFaceAI.stopFaceAge(callback)

config : Callback to know that 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

Sample Code

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