yu4u / age-gender-estimation

Keras implementation of a CNN network for age and gender estimation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to predict just gender

FranciscoSola opened this issue · comments

Hi, thanks for the model and the tutorial. I'd like to use it just to predict gender.
Of course I could use the model to predict both and then use only the one i care about but i would like not to lose processing time in something i don't need. Is there a way to sort it out?
Thanks in advance!

Actually, no. Current model simultaneously estimates age and gender. Thus, there is little computational overhead that can be reduced.

The program now already supports recognizing only gender.

You can try like this:

from deepface import DeepFace

objs = DeepFace.analyze(img_path = "path/to/your/image.jpg", # use the directory of the image you want to recognize
actions = ['gender'] # only gender detection
)
print(objs[0]["dominant_gender"])