Deep Learning | Computer Vision | Real-Time Face Emotion Analysis
This project implements a real-time facial emotion recognition system using Convolutional Neural Networks (CNNs) and Haar Cascade face detection.
The model is trained on the FER-2013 dataset and classifies facial expressions into seven emotion categories with high accuracy and low-latency inference.
The system is optimized for real-time performance, achieving 20–25 FPS with <100 ms per-frame prediction latency on standard hardware.
The model predicts the following 7 emotions:
- Angry
- Disgust
- Fear
- Happy
- Sad
- Surprise
- Neutral
A structured CNN architecture designed for stability and generalization:
- Convolution + ReLU layers
- Max Pooling layers
- Dropout for regularization
- Fully Connected (Dense) layers
- Softmax output layer
Input shape: 48 × 48 × 1 (grayscale)
FER-2013 Facial Expression Dataset
- ~35,000 grayscale facial images
- Resolution:
48 × 48 - Real-world facial expressions under varying conditions
- Grayscale conversion
- Image normalization
- Dataset structuring (train / validation split)
- Noise reduction for improved stability
Real-time face detection and emotion inference using OpenCV:
- Webcam frame capture
- Face detection using Haar Cascade Classifier
- Face ROI extraction
- Image preprocessing (resize + normalize)
- CNN-based emotion prediction
- Emotion label overlay on live video
| Metric | Value |
|---|---|
| Validation Accuracy | 81% |
| Inference Speed | 20–25 FPS |
| Prediction Latency | <100 ms / frame |
| Input Noise Sensitivity | Reduced by ~30% |
- ✅ Real-time webcam emotion recognition
- ✅ Robust face detection using Haar Cascades
- ✅ Modular preprocessing and training scripts
- ✅ CLI-based automation
git clone https://github.com/your-username/Emotion-Recognition-CNN.git
cd Emotion-Recognition-CNN
2️⃣ Install dependencies
pip install -r requirements.txt
python src/train.py
🔹 Evaluate the model
python src/evaluate.py
🔹 Real-time emotion detection (Webcam)
python src/realtime_emotion.py