This repository is used for finding and predicting from an image one or multiple human's gender and age(confidence scores provided for both age and gender). 97% acc for gender and MAE of 4.7 for age.
- python3, pytorch
pip3 install --upgrade opencv-python, imutils, skimage
- using retinaface
- Put your image in pics/ (see config.ini for naming details)
- Run preprocessing steps in
preprocess.py
- Run
train.py
- Using cleaned(https://drive.google.com/file/d/1Bd7o1_rlpG-NTk9ny4jkxilDJitq1Rl9/view?usp=sharing)[1] for training .
- Using FG-NET dataset[3] for testing.
- Train a,
- the output is 2 neuron represents probs of male&female plus 100 neurons represents probs of being age 0-99.
- auto detect if use GPU or even multiple GPUs for training.
- auto reduce learning rate when we have no loss reduce on val dataset for >N epochs.
- auto freeze CNN layers and train only last FCN layers when first epoch.
- auto load and save weights, log training loss and metadatas after each epoch.
- more detains can be found on src file
train.py
and configuration fileconfig.ini
- detect and align faces using
retinaface
. - predict age, gender and confidence scores(probability of each gender and variance of age).