This project is a Real-Time Emotion Detection application built with Python, OpenCV, and Keras. It captures video from a webcam, detects faces, and classifies emotions in real-time, specifically tracking “happy” expressions for a duration of approximately 3 seconds. When a “happy” face is detected continuously for this threshold, a message is displayed on the video feed.
q
key.To run this project, you need the following libraries:
Install dependencies with:
pip install opencv-python keras tensorflow numpy
emotion_detection.py
: Main script for running the emotion detection application.haarcascade_frontalface_default.xml
: Haar Cascade Classifier file for face detection.model.h5
: Pre-trained model for emotion classification.git clone https://github.com/haffarsadok/EmoDetect.git
cd emotion-detection-app
q
key to exit the application.The emotion detection model is a convolutional neural network (CNN) trained on facial emotion datasets. It classifies emotions into the following categories:
To adjust the duration for which a “happy” expression must be detected, modify the happy_duration_threshold
variable in emotion_detection.py
.
We welcome contributions! Feel free to open issues or submit pull requests for improvements or additional features.
This project is licensed under the MIT License.