All Projects → yu4u → Age Gender Estimation

yu4u / Age Gender Estimation

Licence: mit
Keras implementation of a CNN network for age and gender estimation

Projects that are alternatives of or similar to Age Gender Estimation

Accurate Binary Convolution Network
Binary Convolution Network for faster real-time processing in ASICs
Stars: ✭ 49 (-95.9%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Cnn graph
Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering
Stars: ✭ 1,110 (-7.11%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Very Deep Convolutional Networks For Natural Language Processing In Tensorflow
implement the paper" Very Deep Convolutional Networks for Natural Language Processing"(https://arxiv.org/abs/1606.01781 ) in tensorflow
Stars: ✭ 54 (-95.48%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Yann
This toolbox is support material for the book on CNN (http://www.convolution.network).
Stars: ✭ 41 (-96.57%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Gtsrb
Convolutional Neural Network for German Traffic Sign Recognition Benchmark
Stars: ✭ 65 (-94.56%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Computervision Recipes
Best Practices, code samples, and documentation for Computer Vision.
Stars: ✭ 8,214 (+587.36%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Keras model compression
Model Compression Based on Geoffery Hinton's Logit Regression Method in Keras applied to MNIST 16x compression over 0.95 percent accuracy.An Implementation of "Distilling the Knowledge in a Neural Network - Geoffery Hinton et. al"
Stars: ✭ 59 (-95.06%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Brain Tumor Segmentation Keras
Keras implementation of the multi-channel cascaded architecture introduced in the paper "Brain Tumor Segmentation with Deep Neural Networks"
Stars: ✭ 20 (-98.33%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Audio classification
CNN 1D vs 2D audio classification
Stars: ✭ 65 (-94.56%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Deep Atrous Cnn Sentiment
Deep-Atrous-CNN-Text-Network: End-to-end word level model for sentiment analysis and other text classifications
Stars: ✭ 64 (-94.64%)
Mutual labels:  convolutional-neural-networks, imdb
Teacher Student Training
This repository stores the files used for my summer internship's work on "teacher-student learning", an experimental method for training deep neural networks using a trained teacher model.
Stars: ✭ 34 (-97.15%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Equivariant Transformers
Equivariant Transformer (ET) layers are image-to-image mappings that incorporate prior knowledge on invariances with respect to continuous transformations groups (ICML 2019). Paper: https://arxiv.org/abs/1901.11399
Stars: ✭ 68 (-94.31%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Keras Faster Rcnn
Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks
Stars: ✭ 28 (-97.66%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Svhn Cnn
Google Street View House Number(SVHN) Dataset, and classifying them through CNN
Stars: ✭ 44 (-96.32%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Deep learning projects
Stars: ✭ 28 (-97.66%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Convisualize nb
Visualisations for Convolutional Neural Networks in Pytorch
Stars: ✭ 57 (-95.23%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Dl Workshop Series
Material used for Deep Learning related workshops for Machine Learning Tokyo (MLT)
Stars: ✭ 857 (-28.28%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Traffic Sign Classifier
Udacity Self-Driving Car Engineer Nanodegree. Project: Build a Traffic Sign Recognition Classifier
Stars: ✭ 12 (-99%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Pneumonia Detection From Chest X Ray Images With Deep Learning
Detecting Pneumonia in Chest X-ray Images using Convolutional Neural Network and Pretrained Models
Stars: ✭ 64 (-94.64%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks
Sru Deeplearning Workshop
دوره 12 ساعته یادگیری عمیق با چارچوب Keras
Stars: ✭ 66 (-94.48%)
Mutual labels:  jupyter-notebook, convolutional-neural-networks

Age and Gender Estimation

This is a Keras implementation of a CNN for estimating age and gender from a face image [1, 2]. In training, the IMDB-WIKI dataset is used.

  • [Aug. 21, 2020] Refactored; use tensorflow.keras
  • [Jun. 30, 2019] Another PyTorch-based project was released
  • [Nov. 12, 2018] Enable Adam optimizer; seems to be better than momentum SGD
  • [Sep. 23, 2018] Demo from directory
  • [Aug. 11, 2018] Add age estimation sub-project here
  • [Jul. 5, 2018] The UTKFace dataset became available for training.
  • [Apr. 10, 2018] Evaluation result on the APPA-REAL dataset was added.

Dependencies

  • Python3.6+

Tested on:

  • Ubuntu 16.04, Python 3.6.9, Tensorflow 2.3.0, CUDA 10.01, cuDNN 7.6

Usage

Use trained model for demo

Run the demo script (requires web cam). You can use --image_dir [IMAGE_DIR] option to use images in the [IMAGE_DIR] directory instead.

python demo.py

The trained model will be automatically downloaded to the pretrained_models directory.

Create training data from the IMDB-WIKI dataset

First, download the dataset. The dataset is downloaded and extracted to the data directory by:

./download.sh

Secondly, filter out noise data and serialize labels into .csv file. Please check check_dataset.ipynb for the details of the dataset. The training data is created by:

python create_db.py --db imdb
usage: create_db.py [-h] [--db DB] [--min_score MIN_SCORE]

This script cleans-up noisy labels and creates database for training.

optional arguments:
  -h, --help            show this help message and exit
  --db DB               dataset; wiki or imdb (default: imdb)
  --min_score MIN_SCORE minimum face_score (default: 1.0)

The resulting files with default parameters are included in this repo (meta/imdb.csv and meta/wiki.csv), thus there is no need to run this by yourself.

Create training data from the UTKFace dataset [currently not supported]

Firstly, download images from the website of the UTKFace dataset. UTKFace.tar.gz can be downloaded from Aligned&Cropped Faces in Datasets section. Then, extract the archive.

tar zxf UTKFace.tar.gz UTKFace

Finally, run the following script to create the training data:

python create_db_utkface.py -i UTKFace -o UTKFace.mat

[NOTE]: Because the face images in the UTKFace dataset is tightly cropped (there is no margin around the face region), faces should also be cropped in demo.py if weights trained by the UTKFace dataset is used. Please set the margin argument to 0 for tight cropping:

python demo.py --weight_file WEIGHT_FILE --margin 0

The pre-trained weights can be found here.

Train model

Train the model architecture using the training data created above:

python train.py

Trained weight files are stored as checkpoints/*.hdf5 for each epoch if the validation loss becomes minimum over previous epochs.

Changing model or the other training parameters

You can change default setting(s) from command line as:

python train.py model.model_name=EfficientNetB3 model.batch_size=64

Available models can be found here.

Check training curve

The training logs can be easily visualized via wandb by:

  1. create account from here
  2. create new project in wandb (e.g. "age-gender-estimation")
  3. run wandb login on terminal and authorize
  4. run training script with wandb.project=age-gender-estimation argument
  5. check dashboard!

Use the trained model

python demo.py
usage: demo.py [-h] [--weight_file WEIGHT_FILE] [--margin MARGIN]
               [--image_dir IMAGE_DIR]

This script detects faces from web cam input, and estimates age and gender for
the detected faces.

optional arguments:
  -h, --help            show this help message and exit
  --weight_file WEIGHT_FILE
                        path to weight file (e.g. weights.28-3.73.hdf5)
                        (default: None)
  --margin MARGIN       margin around detected face for age-gender estimation
                        (default: 0.4)
  --image_dir IMAGE_DIR
                        target image directory; if set, images in image_dir
                        are used instead of webcam (default: None)

Please use the best model among checkpoints/*.hdf5 for WEIGHT_FILE if you use your own trained models.

Estimated results

Trained on imdb, tested on wiki.

Evaluation

Evaluation on the APPA-REAL dataset

You can evaluate a trained model on the APPA-REAL (validation) dataset by:

python evaluate_appa_real.py --weight_file WEIGHT_FILE

Please refer to here for the details of the APPA-REAL dataset.

The results of trained model is:

MAE Apparent: 5.33
MAE Real: 6.22

The best result reported in [5] is:

MAE Apparent: 4.08
MAE Real: 5.30

Please note that the above result was achieved by finetuning the model using the training set of the APPA-REAL dataset.

License

This project is released under the MIT license. However, the IMDB-WIKI dataset used in this project is originally provided under the following conditions.

Please notice that this dataset is made available for academic research purpose only. All the images are collected from the Internet, and the copyright belongs to the original owners. If any of the images belongs to you and you would like it removed, please kindly inform us, we will remove it from our dataset immediately.

Therefore, the pretrained model(s) included in this repository is restricted by these conditions (available for academic research purpose only).

References

[1] R. Rothe, R. Timofte, and L. V. Gool, "DEX: Deep EXpectation of apparent age from a single image," in Proc. of ICCV, 2015.

[2] R. Rothe, R. Timofte, and L. V. Gool, "Deep expectation of real and apparent age from a single image without facial landmarks," in IJCV, 2016.

[3] H. Zhang, M. Cisse, Y. N. Dauphin, and D. Lopez-Paz, "mixup: Beyond Empirical Risk Minimization," in arXiv:1710.09412, 2017.

[4] Z. Zhong, L. Zheng, G. Kang, S. Li, and Y. Yang, "Random Erasing Data Augmentation," in arXiv:1708.04896, 2017.

[5] E. Agustsson, R. Timofte, S. Escalera, X. Baro, I. Guyon, and R. Rothe, "Apparent and real age estimation in still images with deep residual regressors on APPA-REAL database," in Proc. of FG, 2017.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].