Skip to content

Divyanshu-hash/Real-Time-Emotion-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

😃 Real-Time Emotion Detection Using MobileNetV2

This project detects human emotions in real time using a webcam. It uses OpenCV for face detection and a MobileNetV2-based deep learning model (trained using transfer learning) for emotion classification.


🔍 Features

  • Real-time face detection using Haar cascades
  • Emotion prediction using MobileNetV2
  • 7 supported emotions:
    Angry, Disgust, Fear, Happy, Neutral, Sad, Surprise
  • Works with standard webcam
  • Lightweight and efficient

🧠 Emotion Classes

Label Index
Angry 0
Disgust 1
Fear 2
Happy 3
Neutral 4
Sad 5
Surprise 6

📦 Installation

git clone https://github.com/your-username/emotion-detection.git
cd emotion-detection
python -m venv venv
source venv/bin/activate    # or venv\Scripts\activate on Windows
pip install -r requirements.txt

🧠 Model File

EmotionModel.h5

▶️ Usage

python detect_emotion.py

The webcam will open and start detecting emotions in real-time.

Press q to quit.

🗂️ Project Structure

emotion-detection/
├── main.py        # Real-time detection script
├── EmotionModel.h5          # Trained Keras model
├── requirements.txt         # Python dependencies
└── README.md                # Project documentation
└── dataPreprocessing.ipynb  # Making Model process

💡 How It Works

Captures live video using OpenCV.

Detects faces using Haar Cascades.

Crops and preprocesses each face to 224x224 RGB format.

Predicts emotion using the MobileNetV2-based model.

Displays the predicted emotion label on the frame.

📜 License

This project is licensed under the MIT License. Feel free to fork and improve it! 🔥

🙋‍♂️ Author

Divyansu Giri

About

Real-Time Emotion Detection using MobileNetV2 is a deep learning project that detects and classifies human emotions in real time via webcam. It uses a MobileNetV2 model trained on facial expressions and OpenCV for face detection to recognize emotions like Happy, Sad, Angry, and more.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors