Face Gender

Analyzes the gender of a face in a video stream. The event listener continuously gets the data in a JSON object as FaceAI analyzes the face gender.

Methods

  • EnxFaceAI.startFaceGender(config, callback) : To start analyze face gender in a video Stream
  • EnxFaceAI.stopFaceGender(callback) : To stop analyze face gender in a video Stream

Parameters

For Method: EnxFaceAI.startFaceGender(config, callback)

  • config – JSON Object. This is to configure or customize parameter using which the Face Gender would be analyzed.
    • smoothness: Number. Default 0.95. Range 0-1. A value closer to 1 provides greater smoothing and slower response time. Lower values provide less smoothing but faster response time. Set it to 0 (zero) if you need the raw signal.
    • threshold: Number. Default 0.70. Range 0.5-1. It controls the minimum value of confidence for which mostConfident output returns the predicted gender name instead of undefined.
  • callback: Callback to know that processing request has been accepted.

For Method: EnxFaceAI.stopFaceGender(callback)

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

Event Listener

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

JSON Object: Received with Face Gender Analysis data.

{ output: {
gender: {
Female: Number,
Male: Number
},
mostConfident: String
}
}

Analysis Data Explanation

  • output : Face Gender Report
    • gender : Filtered (smoothened) probabilities of the gender prediction:
      • Female : Probability weightage for gender is female
      • Male : Probability weightage for gender is male
    • mostConfident : Gender name of the most likely result if its smoothened probability is above the threshold, otherwise it is undefined.

Sample Code

config = {
smoothness: 0.95,
threshold: 0.70
};
// Start Face Gender
faceAI.startFaceGender(config, (res) => {
if (res.result === 0) {
window.addEventListener("face-gender", (evt) => {
console.log(evt.detail, "face-gender");
});
}
});
// Stop Face Gender
faceAI.stopFaceGender((res) => {
if (res.result === 0) { }
});