Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize facial emotion recognition in Python

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will talk to you about how to achieve facial emotion recognition in Python. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something from this article.

First, facial detection

Face_recognition project address: https://github.com/ageitgey/face_recognition

Here we try the face_recognition project. Face_recognition needs a package called dlib, which may not fit through pip, so it is recommended that you use anaconda to install dlib:

Conda install-c conda-forge dlib

Then install Face_recognition:

Pip install face_recognition

You can recognize the face in the image with three sentences of face_recognition code:

Second, emotion detection

Humans are used to absorbing non-verbal cues from facial expressions, so can computers? The answer is yes, but it needs to be trained to recognize emotions. Today we are unlikely to talk about logical processes such as collecting data and building CNN models. In fact, this process is similar to the method we did in the last "hand-in-hand teaching you face recognition auto-boot", except that you need to collect an emotional data set.

Because of the time constraint, we directly use the model trained by priya-dwivedi, and they train a six-layer convolution neural network model with Kaggle open source data set (facial emotion recognition FER). Their project source code:

Github.com/priya-dwivedi/face_and_emotion_detection

Now call the model to identify Brother Sun's emotion in this picture. The calling method is shown in the following code. If you don't understand anything, you are advised to leave a message to ask questions. The 1.png in the code is the picture of Brother Sun.

Emoiton.py:

After reading the above, do you have any further understanding of how to realize facial emotion recognition in Python? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 258

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report