Community
cancel
Showing results for 
Search instead for 
Did you mean: 
lawHo
Beginner
62 Views

Output data of the age-gender-recognition-retail-0013 -model

Hi!

I try to predict age and gender from a face image with age-gender-recognition-retail-0013 -model but I can't seem to understand the documentation correctly.

 

This is my setup:

 

ageGenderNet = cv2.dnn.readNet("models/age-gender-recognition-retail-0013/FP32/age-gender-recognition-retail-0013.xml",
"models/age-gender-recognition-retail-0013/FP32/age-gender-recognition-retail-0013.bin")
genders = ["female", "male"]
faceBlob = cv2.dnn.blobFromImage(face, 1.0, (227, 227),
(78.4263377603, 87.7689143744, 114.895847746),
swapRB=False)

ageGenderNet.setInput(faceBlob)
aPreds = ageGenderNet.forward()
predict_gender = aPreds[0][1][0][0]
gConfidence = aPreds[0][1][1][0]
gd = genders[int(predict_gender + 0.5)]

predict_age = aPreds[0][0][0][0] * 100
aConfidence = aPreds[0][0][1][0]

 

The gender is predicted correctly,  but the age readings are weird and I think I might be doing something wrong. Looking at a camera for a while I get anything from 1 - 90 for my predicted age. Would appreciate if someone could take a look and tell me if I'm extracting the age prediction and its confidence in a wrong way.

Tags (3)
0 Kudos
2 Replies
Vladimir_Dudnik
Employee
32 Views

It might be helpful to review appropriate Open Model Zoo demo, to see what postprocessing required for the model.

Peh_Intel
Moderator
7 Views

Hi lawHo,


Greetings to you.


First of all, this age-gender-recognition-retail-0013 model, has its own limitation and specification which you may refer to the link below. This model is able to recognize age of people in [18, 75] years old range, it is not applicable for children since their faces were not in the training set. Besides, the input shape for the input image should be in [62, 62].

https://docs.openvinotoolkit.org/2021.2/omz_models_intel_age_gender_recognition_retail_0013_descript...


Based on your coding, I found that your prediction for gender and age are based on the same output layer which means the prediction for the age is actually same as the prediction for the gender. You have to specify the prediction for age and gender to its respective output layer appropriately.


If you have a look in the link attached above, you will find that there are two different output layers mentioned which are “age_conv3” for age and “prob” for gender.


You may refer to this thread that has discussed the same topic before and the solution (coding) is also can be found in the thread.



Regards,

Yu Chern