This project combines a Flask web application with real-time emotion detection capabilities using computer vision and machine learning. The application can detect emotions from webcam feed and visualize them in real-time.
- Real-time emotion detection from webcam feed
- Live emotion visualization with bar charts
- Video recording with emotion annotations
- GIF generation of emotion charts
- Cumulative emotion statistics tracking
- Web interface for easy access
├── app.py # Flask web application
├── emopy.py # Emotion detection and visualization script
├── requirements.txt # Python dependencies
├── static/ # Static files
│ └── favicon.ico # Website favicon
└── artefacts/ # Generated output files
- Python 3.8 or higher
- Webcam
- Virtual environment (recommended)
- Clone the repository:
git clone <repository-url>
cd <repository-name>- Create and activate a virtual environment:
python -m venv .venv
# On Windows
.venv\Scripts\activate
# On Unix or MacOS
source .venv/bin/activate- Install dependencies:
pip install -r requirements.txtStart the Flask web server:
python app.pyThe application will be available at http://localhost:5000
Run the emotion detection script:
python emopy.pyThe script will:
- Open your webcam
- Detect emotions in real-time
- Display a live bar chart of emotions
- Save the video feed with emotion annotations
- Generate a GIF of the emotion chart
- Create a cumulative emotion statistics chart
Press 'q' to quit the emotion detection program.
The program generates several output files:
emotion_video.avi: Video recording with emotion annotationsemotion_chart.gif: Animated chart of emotion changescumulative_emotions.jpg: Static chart showing emotion trends over time
- Flask: Web framework
- FER: Face Emotion Recognition
- OpenCV: Computer vision library
- Matplotlib: Data visualization
- NumPy: Numerical computing
- Pandas: Data manipulation
- ImageIO: Image processing
For a complete list of dependencies, see requirements.txt.
Feel free to submit issues and enhancement requests!