This project aims to classify the emotion on a person's face into one of the seven categories (0=Angry, 1=Disgust, 2=Fear, 3=Happy, 4=Sad, 5=Surprise, 6=Neutral), using convolutional neural networks.
It uses fer2013 database which you can download from the link below:
This project consists of a single notebook which has the following:
- Data pre-processing
- Training model
- Testing model and comparing results
I have included a pre-trained model to compare my results.
-
First, we import the dataset and initialize our X_train, y_train, X_test, y_test .
-
Then we create our model architecture. Following is my model architecture:
-
First, we use haar cascade to detect faces in the given image and crop the face accordingly.
-
Then we reshape our image to 48 * 48 pixels to meet the requirements of our trained model and pass it as an input to our model.
-
The output is a list containing seven probabilities, each for an emotion.
-
The index of maximum probability from the list indicates the emotion (0=Angry, 1=Disgust, 2=Fear, 3=Happy, 4=Sad, 5=Surprise, 6=Neutral).