Case Studies


Back Case Studies

Client: Internal project
Length: 3 month
Goal: Determine age and gender for a given image of person 
Tech: Python, TensorFlow


This project started as a playground for learning neural networks and TensorFlow framework. Its goal was to do image processing. For a given image, our deep learning model would find a face on the image, crop it, and then determine age and gender based on the face. As an addition, we extended our model with a feature that would find attributes on faces. For example, if a person wore eyeglasses, which haircut it had, which hair colour, emotion recognition, etc. After the model is trained, we plan to make a web demo where users can upload their photos.


The approach can be divided into several stages:

  1. Data set collection - research and find open data set on internet
  2. Image processing - simple image processing like cropping, scaling, calculate mean, std, and define image read pipeline in TensorFlow
  3. Define neural network architecture for pretraining
  4. Train base neural network
  5. Train each classifier/regressor at top of pretrained neural network
  6. Add new modules such as face detection, face recognition and verification
  7. Make demo


We found a public available data set that contains labeled images. The labels include age, gender and other facial attributes. The faces in this dataset have already been cropped and aligned. We decided to use unsupervised learning that could learn on an unlabeled image database. For this, we trained a stacked denoising autoencoder. Now, there is a pre-trained core for other tasks such as prediction of age and gender. After the pre-training, we attached the predictors of age and gender on top of encoder and trained this new network using labeled images. For face detection we used pretrained multitask convolutional neural network. For face verification and recognition we calculate distance between face vectors from neural network embeddings.


Using the technique of semi-supervised learning, we achieved 98% accuracy on test set for the prediction of gender, and a root mean square error of 7 years. Besides improving results, we plan to extend the model with new features like eyeglasses detection, beard detection, haircut, etc. We also plan to make a web demo where users can upload their own photos.

Previous post Next post