This is a Keras implementation of a CNN network for estimating age and gender from a face image. In training, the IMDB-WIKI dataset is used.
Tested on Ubuntu 16.04, Python 3.5.2, CUDA 8.0, cuDNN 5.0.
- Python3.5+
- Keras
- scipy, numpy, Pandas, tqdm
- OpenCV3
The dataset is downloaded and extracted to the data
directory.
./download.sh
Filter out noise data and serialize images and labels for training into .mat
file.
Please check check_dataset.ipynb
for the details of the dataset.
python3 create_db.py --output data/imdb_db.mat --db imdb --img_size 64
Train the network using the training data created above.
python3 train.py --input data/imdb_db.mat
Plot training curves from history file.
python3 plot_history.py -input models/history_16_8.h5
In the original paper, the pretrained VGG network is adopted. Here the Wide Residual Network (WideResNet) is trained from scratch. I modified the @asmith26's implementation of the WideResNet; two classification layers (for age and gender estimation) are added on the top of the WideResNet. Note that age and gender are estimated independently using different two CNNs.