An face emotion recognition system comprises of two step process i.e. face detection (bounded face) in image followed by emotion detection on the detected bounded face. The following two techniques are used for respective mentioned tasks in face recognition system.
-
Face detection using MTCNN: It is a convolution neural network based face detection algorithm, which I have separately shown in another repository. Face detection using MTCNN
-
Mini Xception CNN: We will train a classification CNN model architecture which takes bounded face (48x48 pixels) as input and predicts probabilities of 7 emotions in the output layer.
This code also the implementation of the paper Real time Convolutional Neural Network for emotion and gender classification. This paper implements a miniature version of Xception CNN architecture. Which have enormously reduced the number of parameters from 600,000 to 60,000, which enables better performance and easy to incorporate in robots.
The dataset used for training is FER2013, which can be easily downloaded from kaggle. Download the dataset and extract the content into ./data folder.
pip install -r requirements.txt
!python3 Train.py
!python3 Test.py
Use the above code for testing the model. You can download the pretrained weight file trained on fer2013 dataset.