Skip to content

MauricioCa07/Emotion_detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Emotion Detection System

A real-time facial emotion recognition system that detects and classifies seven human emotions using deep learning and computer vision.

Emotion Detection System

Overview

This application uses a Convolutional Neural Network (CNN) trained on facial expressions to detect and classify emotions in real-time through a webcam feed. The system can identify seven different emotions: anger, disgust, fear, happiness, neutrality, sadness, and surprise.

Features

  • Real-time emotion detection through webcam
  • User-friendly GUI built with CustomTkinter
  • Visual feedback with progress bars for each emotion probability
  • Easy-to-use controls for starting/stopping detection
  • Responsive design that works on various screen sizes

Dataset

The model was trained using the Face Expression Recognition Dataset from Kaggle. This dataset contains approximately 35,000 grayscale images of faces displaying various emotions.

The dataset includes:

  • 7 emotion categories (angry, disgust, fear, happy, neutral, sad, surprise)
  • 48x48 pixel grayscale images
  • Images already aligned and centered on the face

Model Architecture

The CNN model architecture includes:

  • Multiple convolutional layers with batch normalization
  • Max pooling layers for feature extraction
  • Dropout layers to prevent overfitting
  • Dense layers for classification
  • L2 regularization for better generalization

Performance

The trained model achieved 79% accuracy on the validation set, which is competitive with state-of-the-art models on this challenging dataset.

Requirements

  • Python 3.7+
  • TensorFlow 2.x
  • OpenCV
  • CustomTkinter
  • PIL (Pillow)
  • NumPy

Installation

  1. Clone this repository:
git clone https://github.com/yourusername/emotion-detection.git
cd emotion-detection
  1. Make sure you have a webcam connected to your system.

Usage

  1. Run the application:
python emotion_detector.py
  1. Click "Start Detection" to begin emotion recognition.

  2. The application will display:

    • Live webcam feed
    • Currently detected emotion
    • Probability bars for each emotion
  3. Click "Stop Detection" to pause or "Quit" to exit the application.

Training Your Own Model

If you want to train your own model:

  1. Download the Face Expression Recognition Dataset from Kaggle.

  2. Organize the dataset in the following structure:

carpetas/
├── train/
│   ├── angry/
│   ├── disgust/
│   ├── fear/
│   ├── happy/
│   ├── neutral/
│   ├── sad/
│   └── surprise/
└── test/
    ├── angry/
    ├── disgust/
    ├── fear/
    ├── happy/
    ├── neutral/
    ├── sad/
    └── surprise/
  1. Run the training script:
python train_model.py
  1. The trained model will be saved as modelo_entrenado.keras.

Acknowledgments

Contact

If you have any questions or suggestions, please open an issue or contact carrillomauricio007@gmail.com.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages