This project is the final assignment in TDT4173 Machine Learning, NTNU Trondheim. Adrian Kjærran, Erling Stray-Bugge and Christian Vennerød have created a deep CNN network for multi-class age classification. The notebooks are published here in this repository, along with a script which you can download and run for yourselves. Please note that the script is a hybrid variant, where a exact age is estimated from the predicted softmax class distributions and an assumption that mean ages in each class is the middle age, e.g. mean age of (30-35) is 32.5.
Our published paper: https://arxiv.org/abs/2105.06746
- Our YouTube video is here: https://www.youtube.com/watch?v=haNNlZm7L2o&ab_channel=ChrisBv
If you have problems with downloading the dependencies, try to pip import the following wrappers/libraries:
- opencv-python (for cv2)
- Keras (for keras)
- tensorflow (tf)
- Pillow-PIL (PIL Image wrapper)
- cmake (for the face-recognition library to work)
- face-recognition (might take some time if dlib is not installed)
Only tested on MacOS Catalina with Python 3.8.
Required dependencies: TensorFlow, Keras, CV2, face_recognition, Numpy, and PIL.
- Download the file 'inference_CNN.py' from this repo
- Download our TensorFlow age estimation models:
- Either our ADAM model, from https://storage.cloud.google.com/ntnu-ml-bucket/models/model_adam_v2_14_11.zip (authenticate with Google)
- Our our CNN model, from https://storage.cloud.google.com/ntnu-ml-bucket/models/cnn_20201114_143814.zip (authenticate with Google).
- Unzip the zip file, and place the folder in a convenient destination.
- Copy the absolute destination path for the folder, and replace the path at line 16 under the variable "model_path" with your own path, in string format.
- Run the model, and estimate your own age :D
Contains:
- Code for downloading the different datasets
- Preprocessing the datasets
- Training the models
- Evaluating the models by visualizing metrics in Tensorboard.
Please check out the READme file in the notebooks folder for further descriptions.
- Remember to authenticate with Google.
Link to Appa dataset: https://storage.cloud.google.com/ntnu-ml-bucket/Appa/appa_by_age_256_FIXED.zip Link to IMDB dataset: https://storage.cloud.google.com/ntnu-ml-bucket/IMDB/IMDB_by_age.zip Link to UTK dataset: https://storage.cloud.google.com/ntnu-ml-bucket/Utk/utk_by_age_256_FIXED.zip
- Remember to authenticate with Google.
- A deep-CNN with 5 conv. layers and adam was trained on our data. This is our final model, and is found here:
- When training this model, we logged to GSB for each batch. The final zip file with logs from each batch when training our DCNN is found here (reproducibility):