This project performs real-time emotion detection using a Convolutional Neural Network (CNN) model and OpenCV. It detects human facial expressions like Happy, Sad, Angry, and more from webcam video input 🎥 and displays a live stats overlay including FPS and detected emotions.
- 🎯 Accurate emotion classification using deep learning
- 📦 Real-time face detection with OpenCV
- ⚡ Displays FPS and number of faces detected
- 📊 Live emotion stats with color-coded labels
- 🎨 Clean and dynamic on-screen overlay
- 😠 Angry
- 🤢 Disgust
- 😨 Fear
- 😀 Happy
- 😢 Sad
- 😲 Surprise
- 😐 Neutral
To train your own model or explore the data, download the full dataset from Kaggle:
🔗 Face Expression Recognition Dataset on Kaggle
-
Clone the repository
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name -
Install dependencies
pip install -r requirements.txt
-
Download or place the pre-trained model
- Make sure you have
emotion.h5(trained on FER dataset) - Place it in the project root directory
- Make sure you have
-
Run the emotion detection
python detect_emotion.py
- 🧠 TensorFlow / Keras – for CNN model
- 🎥 OpenCV – for webcam capture and face detection
- 📊 NumPy – for numerical processing
- 💾 Haar Cascades – for real-time face detection
- 🐍 Python – programming language used
├── detect_emotion.py # Main detection script
├── emotion.h5 # Trained CNN model
├── requirements.txt # Python dependencies
├── README.md # Project documentation
└── demo.gif # Sample output (replace with your own)
- Dataset from Kaggle FER Dataset
- CNN Model built with Keras
- Face detection using OpenCV Haar Cascades
- Developed with ❤️ by Aditya Raj
- 🔗 GitHub: @ADiTyaRaj8969
- ✉️ Email: adivid198986@gmail.com
- 💼 LinkedIn: Aditya Raj