We have seen in the previous blog on Face Detection on the image, and we will see how to recognize Facial Emotion in this blog.
Today, we can see many apps that can recognize human emotions from the face, whether you are happy, sad, angry, jealous, etc.
We will see the DeepFace library, which tells you the image or video on human emotions. I am going to use an image instead of a video to make this blog simple.
What is DeepFace library?
Deepface is a lightweight face recognition and facial attribute analysis (age, gender, emotion and race) framework for python. It is a hybrid face recognition framework wrapping state-of-the-art models: VGG-Face, Google FaceNet, OpenFace, Facebook DeepFace, DeepID, ArcFace and Dlib. Those models already reached and passed the human level accuracy. The library is mainly based on Keras and TensorFlow.
Source: DeepFace
You can download their library on DeepFace and use it for different purposes like Facial Recognition, Face Verification, Facial Emotions, etc.
I am going to Google Colab, and you can use check here.
GitHub link for DeepFace and Image Source – Photo by RODNAE Productions from Pexels
Let’s start.
{'age': 30, 'dominant_emotion': 'happy', 'dominant_race': 'asian', 'emotion': {'angry': 4.185573599952558e-11, 'disgust': 8.291156883535348e-23, 'fear': 2.743164480561045e-12, 'happy': 99.99487400054932, 'neutral': 0.005059365867055021, 'sad': 4.616149313924761e-12, 'surprise': 7.06747300682764e-05}, 'gender': 'Man', 'race': {'asian': 57.354933900229206, 'black': 7.584592114042295, 'indian': 8.413581062982209, 'latino hispanic': 21.102991235612777, 'middle eastern': 1.5200660513420166, 'white': 4.023840758066267}, 'region': {'h': 245, 'w': 245, 'x': 225, 'y': 119}}
Hurray! DeepFace predicted as Happy Face and also predicts age, gender, race, region etc.
If you look at gender it shows wrong results, anyhow we are check only Facial Emotion, so let’s ruled out this.
What do you think about this library?
What is the extra feature missing on this library?
Please comment.
Further Reading
Posts on Artificial Intelligence, Deep Learning, Machine Learning, and Design Thinking articles:
Artificial Intelligence Chatbot Using Neural Network and Natural Language Processing
Leave A Comment