ht167/emotion-sensor
0
๐ญ Emotion Detection 2.0 โ Deployment Package
Real-time facial emotion detection web application powered by a 4-block CNN trained on FER2013.
Quick Start
Windows
Double-click start.batManual Start
pip install -r requirements.txt
python server.pyThen open http://localhost:8000 in your browser.
File Structure
deploy/
โโโ server.py # FastAPI web server (entry point)
โโโ model_structure.py # CNN architecture definition
โโโ processing.py # Face detection & preprocessing
โโโ emotion_model.h5 # Pre-trained model weights (~12 MB)
โโโ requirements.txt # Python dependencies
โโโ start.bat # Windows startup script
โโโ start.sh # Linux/macOS startup script
โโโ templates/
โ โโโ index.html # Web UI template
โโโ static/
โโโ css/
โ โโโ style.css # Dark glassmorphism theme
โโโ js/
โโโ app.js # Frontend logic (WebSocket + Canvas)How It Works
- Browser captures webcam frames via
getUserMedia() - Frames are sent as base64 JPEG over WebSocket to the server
- Haar Cascade detects face bounding boxes
- Each face is preprocessed: crop โ grayscale โ 48ร48 โ normalize
- CNN (4 conv blocks + softmax) predicts emotion probabilities
- Results are sent back and rendered as live overlays
Emotions Detected
Requirements
- Python 3.8+
- Webcam
- ~500 MB RAM
- No GPU required (CPU-optimized)
Privacy
All processing is performed locally. No images or data leave your machine.
