Convolutional Neural Network (CNN).
This repository contains a source code of a deep learning network built with TensorFlow and Keras to classify gender and estimate age.
- Download the file containing Aligned&Cropped Faces archive. The repository contains 23,708 images with annotations encoded in the filename. All images have 200*200 px resolution.
- Unpack the contents into the
Example input images with actual gender and age:
- Create and activate a virtual environment.
- Install project dependencies with
pip install -r requirements.txt
- Run the
- When running for the first time, select option 1 to split the images into train, validation and test subfolders. There is no need to repeat this operation every time.
- The main menu includes an option to check if your system supports GPU training.
- A pre-trained model is included in the
/.output/modelsfolder. Feel free to overwrite or delete it.
history/age_gender_model.csv contains the training history.
Age – Mean Average Error (MAE)
Gender – Accuracy
Gender – Loss
test the model option from main menu to load a few images and predict age and gender.
Tune down the
batch_size hyperparameter if your GPU runs out of memory.
Tensorflow version that currently supports GPU with the latest CUDA / CUDNN.
pip install tf-nightly-gpu
You might require to install the Graphviz plotting library.
If you encounter an issue with plotting in your IDE, refer to this [Stack Overflow answer](Graphvis issue with plotting]()
Type in the terminal with admin rights: