Python implementation of a live deep learning based age/gender/expression recognizer.
All components use convolutional networks:
- Detection uses an SSD model trained on Tensorflow object detection API, but running on OpenCV.
- Age, gender and facial expression use a mobilenet trained and running on keras.
The detailed functionality of the system is described in our paper:
Janne Tommola, Pedram Ghazi, Bishwo Adhikari, Heikki Huttunen, "Real Time System for Facial Analysis," Submitted to EUVIP2018.
If you use our work for research purposes, consider citing the above work.
Dependencies: OpenCV 3.4.1+, Tensorflow 1.8+, Keras 2.2.2+ and dlib 19.4+.
- Requires a webcam.
- Tested on Ubuntu Linux 16.04, 18.04 and Windows 10 with and without a GPU.
- Install opencv 3.4.1 or newer. Recommended to install with
pip3 install opencv-python
(includes GTK support, which is required). - Install Tensorflow (1.8 or newer). On a CPU, the MKL version seems to be radically faster than others (Anaconda install by smth like
conda install tensorflow=1.10.0=mkl_py36hb361250_0
. Seek for proper versions withconda search tensorflow
.). On GPU, usepip3 install tensorflow-gpu
. Note that CPU is probably faster. - Install Keras 2.2.2 (or newer). Earlier versions have a slightly different way of loading the models. For example:
pip3 install keras
. - Install dlib (version 19.4 or newer) with python 3 dependencies; e.g.,
pip3 install dlib
. - Download the required deep learning models from here [mirror link]. Extract directly to the main folder so that 2 new folders are created there.
- Run with
python3 EstimateAge.py
.
Example video here.
Contributors: Heikki Huttunen, Janne Tommola