Face Analytics

Zia Face Analytics performs facial detection in images, and analyzes the facial features to provide information such as the gender, age, and emotion of the detected faces.

You can learn more from the Face Analytics help page.

You must provide .jpg/.jpeg or .png files as the input. Refer to the API documentation for the request and response formats.

You can enable or disable the age, smile, or gender detection by setting the attributes as true or false. You can also specify the mode as BASIC, MODERATE, or ADVANCED. These values are optional. All attributes are detected and the ADVANCED mode is processed by default.

The response returns the prediction of the enabled attributes, the coordinates and landmarks of facial features of each face, and the confidence score of each analysis.

Ensure the following packages are imported:

import com.zc.component.ml.ZCAge; import com.zc.component.ml.ZCAnalyseMode; import com.zc.component.ml.ZCFaceAnalysisData; import com.zc.component.ml.ZCFaceAnalyticsOptions; import com.zc.component.ml.ZCFaceEmotion; import com.zc.component.ml.ZCFaceLandmark; import com.zc.component.ml.ZCFacePoints; import com.zc.component.ml.ZCFaces; import com.zc.component.ml.ZCGender; import com.zc.component.ml.ZCML; import java.io.File;
File file = new File("{filePath}"); //Specify the file path //Set each attribute detection as required or not required, and the mode of detection ZCFaceAnalyticsOptions options = ZCFaceAnalyticsOptions.getInstance().setAgeNeeded(false) .setEmotionNeeded(true).setGenderNeeded(true).setAnalyseMode(ZCAnalyseMode.ADVANCED); ZCFaceAnalysisData faceData = ZCML.getInstance().analyzeFace(file, options); //Call analyzeFace() with the file and options Long facesCount = faceData.getFacesCount(); //To obtain the count of faces in the image List faces = faceData.getFacesList(); for(ZCFaces face : faces) { //Executed for each detected face Double faceConfidence = face.getConfidence(); //To obtain the confidence score of each analysis ZCAge age = face.getAge(); //To get the age of the face ZCGender gender = face.getGender(); //To get the gender of the face ZCFaceEmotion emotion = face.getEmotion(); //To get smile information ZCFacePoints facePoints = face.getCoordinates(); //To get the coordinates of the face List faceLandmarks = face.getFaceLandmarks(); //To get the landmarks of the facial features }

Last Updated 2023-09-03 01:06:41 +0530 +0530



Face Analytics - API