The Emotion Recognition App is a real-time application that utilizes machine learning to detect and recognize human emotions from a webcam feed. The application uses a pre-trained deep learning model to classify facial expressions into seven different emotions: Angry, Disgusted, Fearful, Happy, Neutral, Sad, and Surprised. This project demonstrates the integration of computer vision and machine learning for emotion analysis, which can have various applications, including user experience enhancement and human-computer interaction.
Understanding human emotions can be valuable in several domains, such as human-computer interaction, sentiment analysis, and mental health monitoring. This Emotion Recognition App provides a simple and interactive way to showcase the capabilities of emotion detection models. It can be used as a starting point for building more advanced applications or for educational purposes in the fields of computer vision and machine learning.
To use the Emotion Recognition App:
- Ensure you have Python installed on your system.
- Install the required libraries by running
pip install -r requirements.txt. - Run the application using
python app.py.
The application will open in your web browser, displaying a webcam feed with real-time emotion recognition. Emotions detected from the faces in the webcam feed will be displayed alongside the video.
- OpenCV: Computer vision library for image and video processing.
- TensorFlow/Keras: Deep learning framework for building and training the emotion detection model.
- Streamlit: Web application framework for creating interactive web applications with Python.
The project structure is organized as follows:
src/app.py: Main script to run the Emotion Recognition App.src/emotion_model.h5: Pre-trained deep learning model weights for emotion detection.src/requirements.txt: List of required Python libraries.
The emotion detection model is a Convolutional Neural Network (CNN) trained to recognize facial expressions. The model is loaded using the load_emotion_model function defined in app.py.
The Streamlit application is initialized using the init_streamlit function. It configures the layout, displays the webcam feed, and provides an interactive sidebar for project information and an exit button.
The main loop (run function) captures frames from the webcam, processes them, and uses the emotion detection model to predict the emotion of each detected face. The detected emotion is then displayed in real-time.
The application can be exited by clicking the "Exit" button in the sidebar. This triggers the release_resources function, which releases the webcam resources and closes OpenCV windows.
- Run the application using
python app.py. - Observe the webcam feed and the real-time emotion recognition display.
- Click the "Exit" button to close the application.
This README provides a high-level overview of the Emotion Recognition App, its importance, usage, and technologies used. For more detailed information, refer to the documentation section below.