This project enables real-time facial emotion recognition using a YOLOv8 model integrated with a Flask web application. The system can classify the following emotions:
- Disgusted
- Surprised
- Angry
- Sad
- Happy
- Scared
- Neutral
Here are some screenshots of the application in action:
This project leverages the YOLOv8 model for detecting facial emotions. A custom dataset was created by translating emotion labels from Malay to English for improved usability. The Flask application provides a user-friendly interface for both uploading images and real-time emotion detection via webcam.
-
Clone the repository:
git clone https://github.com/hasnain3142/Facial-Emotion-Recognition.git cd Facial-Emotion-Recognition
-
Set up a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the Flask application:
python app.py
-
Open your web browser and navigate to:
http://127.0.0.1:5000/
-
Upload an image or use the webcam for real-time emotion detection.
app.py
: The main Flask application file.requirements.txt
: List of dependencies required for the project.templates/
: Directory containing HTML templates for the Flask app.static/
: Directory for static files such as uploaded images.models/
: Directory containing the trained YOLOv8 model.train/
: Directory containing the training script.README.md
: This documentation file.
- Original Dataset: Expression Detection (Malay Labels)
- Modified Dataset: Facial Emotion Recognition (English Labels)
The original dataset's emotion labels were translated from Malay to English, and the modified dataset is available on Kaggle for use.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to contribute to this project by opening issues or submitting pull requests. Happy coding!