Week 6 — Emotion Detection

Şeyma Yılmaz
bbm406f19
Published in
3 min readJan 5, 2020

Hello everyone! We share with you the last post of our Machine Learning project this week. We will talk about the methods we use to increase the model accuracy which we specified last week. Besides, we tested our model in real-time using face recognition. You can continue reading for all of them.

In our previous post, we said that we had a dataset and that was not enough. Therefore, we found a different dataset in Kaggle. This dataset is referred to as fer2013. It contains approximately 25k data. When we used our resnet34 model with this dataset, the accuracy rate increased to 74%. We wanted to try it on other models, but as the data size gets larger, we observed that the epoch time of the other models increased. Hence, we did the next operations using ResNet-34 model.

[1] According to our researches, we have learned that animation data set can be used to increase this accuracy. We realized that we need to perform some pre-processes for this animation data. For this, we first detected the face in the photo and cut it. Then we reduced the size of the image to 48x48 and set it as grayscale. Animation data includes a total of 56k photos. When we combine this animation data and all human data, the single epoch duration lasted for 7 hours and the accuracy of the resulting model was 84%. However, we tried another method because the number of epochs in this method was low and it took a long time.

As another method, when we combine the human train dataset and only 5k-many of the animation dataset, we observed that the accuracy rate increased to 81%.

Confusion matrix for human dataset
Accuracy values for human dataset
Confusion matrix for human&animation dataset
Accuracy values for human&animation dataset

Face Recognition

In order to test our model in real-time, we capture the images as frames. For this, the face needs to be recognized first. We used OpenCV for facial recognition. [2] Facial recognition is a biometric software application capable of uniquely identifying or verifying a person by comparing and analyzing patterns based on the person’s facial contours.

… and we’re at the end of our project. See you on other projects, goodbye!

Reference:

[1] https://medium.com/datadriveninvestor/real-time-facial-expression-recognition-f860dacfeb6a

[2] https://www.techopedia.com/definition/32071/facial-recognition

--

--