The Emotion Classifier AI is a deep learning project that detects human emotions in real time using facial expressions.
By leveraging Convolutional Neural Networks (CNNs) and OpenCV, this model can recognize various emotions such as Happy, Sad, Angry, Surprise, Neutral, and more — bridging the gap between artificial intelligence and human empathy.
- 🎥 Real-time emotion detection via webcam
- 🧩 CNN-based deep learning model (
emotion_model.h5) - 📊 Trained on the FER-2013 dataset
- 🌐 Deployed on Hugging Face for public interaction
- 💻 Streamlit-ready for local or web deployment
- Language: Python
- Libraries: TensorFlow, Keras, OpenCV, NumPy
- Frameworks: Streamlit / Hugging Face Spaces
- Dataset: FER-2013 (Facial Expression Recognition Dataset)
- Input: 48x48 grayscale facial images
- Layers: 4 convolutional + pooling layers, followed by dense layers
- Activation: ReLU + Softmax
- Output: 7 emotion classes
Try it directly here 👇
👉 Hugging Face Demo
Emotion-Classifier/
┣ 📁 dataset/
┣ 📁 models/
┃ ┗ emotion_model.h5
┣ 📁 images/
┣ 📜 app.py
┣ 📜 requirements.txt
┣ 📜 README.md
┗ 📜 emotion_detector.py
git clone https://github.com/RayanAIX/emotion-classifier.git
cd emotion-classifierpip install -r requirements.txtstreamlit run app.pySimply upload the files and run the notebook cell-by-cell.
| Emotion | Accuracy |
|---|---|
| Happy 😄 | 92% |
| Sad 😢 | 88% |
| Angry 😠 | 87% |
| Surprise 😮 | 91% |
| Neutral 😐 | 90% |
✅ Overall Accuracy: ~90%
- Add multi-face detection in the same frame
- Train on more diverse datasets for better generalization
- Improve lighting & background robustness
- Add real-time emotion tracking analytics
Building this project taught me that AI might not “feel” emotions, but it can learn to recognize them — a crucial step toward empathetic human-AI interaction.
Muhammad Rayan Shahid
AI & ML Engineer | Deep Learning Enthusiast
🌐 Connect with me:
This project is licensed under the MIT License — you’re free to use, modify, and distribute it for educational and personal purposes.
⭐ If you like this project, don’t forget to star the repo!
Your support motivates me to build more open-source AI projects 🚀