π§ Project Summary:
This project implements a real-time facial emotion detection system using a Convolutional Neural Network (CNN) and OpenCV's Haar Cascade Classifier. It captures video from a webcam, detects faces in real time, and classifies them into one of seven emotional states: Anger, Disgust, Fear, Happy, Sad, Surprise, Neutral.
The model is trained on the FER2013 dataset and optimized for deployment in real-world scenarios. Designed with simplicity, efficiency, and educational clarity in mind, the system is ideal for student demos, educational projects, and real-time human-computer interaction research.
π¦ Files and Assets:
File Name Description
emotion_model.h5 Pre-trained CNN model trained on FER2013
main.py Real-time emotion detection script
haarcascades/haarcascade_frontalface_default.xml XML for face detection
README.md Project documentation and usage guide
π Model Details:
Architecture: Convolutional Neural Network (custom 4-layer)
Input Size: 64x64 grayscale
Output: Softmax prediction across 7 emotion classes
Dataset Used: FER-2013
π₯οΈ Tech Stack:
Programming Language: Python
Libraries: OpenCV, TensorFlow/Keras, NumPy
Model Format: .h5 (Keras Saved Model)
π» How it Works:
Captures video feed from the webcam.
Detects faces using Haarcascade XML.
Preprocesses the face image: grayscale, resized to 64x64, normalized.
Uses the CNN to predict emotion.
Displays bounding box and emotion label on-screen.
Optionally includes face-mapping or eye-tracking overlay text.
π Key Features:
π₯ Real-time Emotion Detection
π§ CNN-based Accuracy
π‘ Face Mapping Text Overlay
π§ͺ Optional: Eye Detection Integration
π₯οΈ Lightweight and beginner-friendly code
π Press Q to exit webcam.
π οΈ Future Enhancements:
GUI Integration (Streamlit, Tkinter)
Add audio feedback or logging CSV of emotions
Integrate drowsiness or blink detection via eye tracking
Deploy on Raspberry Pi for edge AI applications
π Model Access (for Ready Tensor or similar platform):
Model Name: FacialEmotionDetector_CNN_Haarcascade
License: MIT
Version: 1.0
Author: Anshuman Tiwari (@anshuman-ai)
Email/Contact: [https://github.com/AnshumanTiwari2006/Face-Emotion-Detection/tree/main]
