Python implementation of a live deep learning based age/gender/smile/celebrity twin recognizer.
All components use convolutional networks:
- Detection uses an SSD model trained on Tensorflow object detection API, but running on OpenCV.
- Age, gender, and smile recognition use a multitask mobilenet trained and running on keras.
- Celebrity twin uses a squeeze-excite seresnet18 to extract features, trained and running on keras.
The detailed functionality of the system (without multitask and celebrity similarity) 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 4.0.1+, Tensorflow 1.8+, Keras 2.2.3+, and faiss.
- Requires a webcam.
- Tested on Ubuntu Linux 16.04, 18.04 and Windows 10 with and without a GPU.
- Install OpenCV 4.0.1 or newer. Recommended to install with
pip3 install opencv-python
(includes GTK support, which is required). Freetype support for nicer fonts requires manual compilation of OpenCV. - 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
. - Install Keras 2.2.3 (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
. - Install faiss with Anaconda
conda install faiss-cpu -c pytorch
. - Run with
python3 EstimateAge.py
.
Required deep learning models and celebrity dataset. Extract directly to the main folder so that 2 new folders are created there.
Contributors: Heikki Huttunen, Janne Tommola