Python implementation of a live deep learning based age/gender/expression recognizer

Overview

TUT live age estimator

Python implementation of a live deep learning based age/gender/smile/celebrity twin recognizer.

Image

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.

Usage instructions:

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 with conda search tensorflow.). On GPU, use pip3 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.

Example video.

Contributors: Heikki Huttunen, Janne Tommola

Comments
  • xrandr | grep

    xrandr | grep "\*" | cut -d" " -f4 do not work on windows

    Is this only supposed to work on linux because I think its a linux command...

    xrandr | grep "*" | cut -d" " -f4

    I get this error :

    Using TensorFlow backend. 'xrandr' is not recognized as an internal or external command, operable program or batch file. Traceback (most recent call last): File "C:/Users/vaun_/PycharmProjects/TUT-live-age-estimator/EstimateAge.py", line 23, in controllerThread = ControllerThread.ControllerThread(params) File "C:\Users\vaun_\PycharmProjects\TUT-live-age-estimator\ControllerThread.py", line 45, in init self.resolution = [int(s) for s in self.resolution] File "C:\Users\vaun_\PycharmProjects\TUT-live-age-estimator\ControllerThread.py", line 45, in self.resolution = [int(s) for s in self.resolution] ValueError: invalid literal for int() with base 10: ''

    Thanks

    opened by Vaunorage 3
  • Not run in python 3.6/3.7

    Not run in python 3.6/3.7

    2019-12-29 11:55:25.596039: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 9754 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2080 Ti, pci bus id: 0000:08:00.0, compute capability: 7.5) Exception in thread Thread-4: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/home/sentinela/VISAOCOMPUTACIONAL/Linuxfx-Age-Estimator/RecognitionThread.py", line 206, in run ageout = self.ageNet.predict(np.expand_dims(agein, 0))[0] File "/home/sentinela/.local/lib/python3.7/site-packages/keras/engine/training.py", line 1462, in predict callbacks=callbacks) File "/home/sentinela/.local/lib/python3.7/site-packages/keras/engine/training_arrays.py", line 324, in predict_loop batch_outs = f(ins_batch) File "/home/sentinela/.local/lib/python3.7/site-packages/tensorflow/python/keras/backend.py", line 3289, in call self._make_callable(feed_arrays, feed_symbols, symbol_vals, session) File "/home/sentinela/.local/lib/python3.7/site-packages/tensorflow/python/keras/backend.py", line 3222, in _make_callable callable_fn = session._make_callable_from_options(callable_opts) File "/home/sentinela/.local/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1489, in _make_callable_from_options return BaseSession._Callable(self, callable_options) File "/home/sentinela/.local/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1446, in init session._session, options_ptr) tensorflow.python.framework.errors_impl.InvalidArgumentError: Tensor input_1:0, specified in either feed_devices or fetch_devices was not found in the Graph

    Any IDEA?

    opened by linuxfxdevil 2
  • add windows dependency please..

    add windows dependency please..

    I only use Windows. legacy project was successfully run with Windows. but current updated project is doesn't work with Windows because "faiss" module is not support Windows. can you modify this problem? i really want Windows version. thank you!

    opened by 2p990i9hpral 2
  • What does this code mean

    What does this code mean

    i don't understand why below code is used

    I expect two lines to be Convert range of x from 0 to 1, but the subtraction codes below are totally incomprehensible.

    i want to know why these code is used thank you

    @staticmethod
    def preprocess_input(img):
    	x = img - img.min()
    	x = 255.0 * x / x.max()
    
    	x[..., 0] -= 103.939
    	x[..., 1] -= 116.779
    	x[..., 2] -= 123.68
    	return x
    
    opened by 2p990i9hpral 2
  • The deep learning model cannot be downloaded.

    The deep learning model cannot be downloaded.

    When I tried to download the model from Onedrive, some files were not downloaded. The limit of file downloads has been reached. The total number of file downloads cannot be greater than 200.

    So could you please refresh the link?

    Thanks a lot.

    opened by YYShi12 1
  • Major updates to detection & recognition, updated to Python 3, other minor changes

    Major updates to detection & recognition, updated to Python 3, other minor changes

    CascadeClassifier in detection replaced with a Tensorflow SSD-Mobilenet used through OpenCV. Caffe-models in recognition replaced by Keras mobilenets. Changed all Python 2 code to Python 3.

    • other minor changes and additions
    opened by jtomm 0
  • configparser.ParsingError:

    configparser.ParsingError:

    configparser.ParsingError: Source contains parsing errors: 'config.ini'

    I am having this error while running code. It would be great if you will provide some input.

    opened by Otarik641 0
Owner
Heikki Huttunen
AI Lead at Visy
Heikki Huttunen
A deep learning network built with TensorFlow and Keras to classify gender and estimate age.

Convolutional Neural Network (CNN). This repository contains a source code of a deep learning network built with TensorFlow and Keras to classify gend

Pawel Dziemiach 1 Dec 18, 2021
A deep learning network built with TensorFlow and Keras to classify gender and estimate age.

Convolutional Neural Network (CNN). This repository contains a source code of a deep learning network built with TensorFlow and Keras to classify gend

Pawel Dziemiach 1 Dec 19, 2021
This is a Keras implementation of a CNN for estimating age, gender and mask from a camera.

face-detector-age-gender This is a Keras implementation of a CNN for estimating age, gender and mask from a camera. Before run face detector app, expr

Devdreamsolution 2 Dec 4, 2021
This is an easy python software which allows to sort images with faces by gender and after by age.

Gender-age Classifier This is an easy python software which allows to sort images with faces by gender and after by age. Usage First install Deepface

Claudio Ciccarone 6 Sep 17, 2022
Deepface is a lightweight face recognition and facial attribute analysis (age, gender, emotion and race) framework for python

deepface Deepface is a lightweight face recognition and facial attribute analysis (age, gender, emotion and race) framework for python. It is a hybrid

Kushal Shingote 2 Feb 10, 2022
Age and Gender prediction using Keras

cnn_age_gender Age and Gender prediction using Keras Dataset example : Description : UTKFace dataset is a large-scale face dataset with long age span

XN3UR0N 58 May 3, 2022
Implement face detection, and age and gender classification, and emotion classification.

YOLO Keras Face Detection Implement Face detection, and Age and Gender Classification, and Emotion Classification. (image from wider face dataset) Ove

Chloe 10 Nov 14, 2022
A simple rest api serving a deep learning model that classifies human gender based on their faces. (vgg16 transfare learning)

this is a simple rest api serving a deep learning model that classifies human gender based on their faces. (vgg16 transfare learning)

crispengari 5 Dec 9, 2021
AgeGuesser: deep learning based age estimation system. Powered by EfficientNet and Yolov5

AgeGuesser AgeGuesser is an end-to-end, deep-learning based Age Estimation system, presented at the CAIP 2021 conference. You can find the related pap

null 5 Nov 10, 2022
Python library to receive live stream events like comments and gifts in realtime from TikTok LIVE.

TikTokLive A python library to connect to and read events from TikTok's LIVE service A python library to receive and decode livestream events such as

Isaac Kogan 277 Dec 23, 2022
Pytorch implementation for "Implicit Feature Alignment: Learn to Convert Text Recognizer to Text Spotter".

Implicit Feature Alignment: Learn to Convert Text Recognizer to Text Spotter This is a pytorch-based implementation for paper Implicit Feature Alignme

wangtianwei 61 Nov 12, 2022
A PyTorch implementation of "From Two to One: A New Scene Text Recognizer with Visual Language Modeling Network" (ICCV2021)

From Two to One: A New Scene Text Recognizer with Visual Language Modeling Network The official code of VisionLAN (ICCV2021). VisionLAN successfully a

null 81 Dec 12, 2022
RealTime Emotion Recognizer for Machine Learning Study Jam's demo

Emotion recognizer Table of contents Clone project Dataset Install dependencies Main program Demo 1. Clone project git clone https://github.com/GDSC20

Google Developer Student Club - UIT 1 Oct 5, 2021
GAN Image Generator and Characterwise Image Recognizer with python

MODEL SUMMARY 모델의 구조는 크게 6단계로 나뉩니다. STEP 0: Input Image Predict 할 이미지를 모델에 입력합니다. STEP 1: Make Black and White Image STEP 1 은 입력받은 이미지의 글자를 흑색으로, 배경을

Juwan HAN 1 Feb 9, 2022
Official repository of the AAAI'2022 paper "Contrast and Generation Make BART a Good Dialogue Emotion Recognizer"

CoG-BART Contrast and Generation Make BART a Good Dialogue Emotion Recognizer Quick Start: To run the model on test sets of four datasets, Download th

null 39 Dec 24, 2022
Only a Matter of Style: Age Transformation Using a Style-Based Regression Model

Only a Matter of Style: Age Transformation Using a Style-Based Regression Model The task of age transformation illustrates the change of an individual

null 444 Dec 30, 2022
An implementation of paper `Real-time Convolutional Neural Networks for Emotion and Gender Classification` with PaddlePaddle.

简介 通过PaddlePaddle框架复现了论文 Real-time Convolutional Neural Networks for Emotion and Gender Classification 中提出的两个模型,分别是SimpleCNN和MiniXception。利用 imdb_crop

null 8 Mar 11, 2022
Neural network for recognizing the gender of people in photos

Neural Network For Gender Recognition How to test it? Install requirements.txt file using pip install -r requirements.txt command Run nn.py using pyth

Valery Chapman 1 Sep 18, 2022
Official implementation for ICDAR 2021 paper "Handwritten Mathematical Expression Recognition with Bidirectionally Trained Transformer"

Handwritten Mathematical Expression Recognition with Bidirectionally Trained Transformer Description Convert offline handwritten mathematical expressi

Wenqi Zhao 87 Dec 27, 2022