Advanced Face Detection & Emotion Classification Pipeline
Powered by 🐍 Python · 👁️ OpenCV · 🧠 Deep Learning (CNN)
FaceSentrix is a highly interactive, real-time emotion detection system designed to identify human faces from live camera feeds (or videos/images) and classify their emotional states using a meticulously optimized Convolutional Neural Network (CNN).
| # | Objective | Description |
|---|---|---|
| 1 | 📸 Face Detection | Real-time face localization using OpenCV (Haar Cascades / DNN). |
| 2 | 🧠 Emotion Classification | Categorizes expressions into Happy, Sad, Angry, Surprise, Fear, Disgust, Neutral. |
| 3 | ⚡ Low Latency | Optimized for smooth, live camera feed processing (target: ≥15-30 FPS). |
| 4 | 📊 Visual Feedback | Dynamic bounding boxes with confidence meters and labels overlaid on faces. |
| 5 | 🚀 Scalable Pipeline | End-to-end framework: Data Preparation → Augmentation → Training → Inference. |
The architecture of FaceSentrix leverages a streamlined data flow ensuring minimal latency from capture to classification.
graph TD
A[📷 Camera / Video Input] -->|Raw Frame| B[🔍 Face Detection Layer]
B -->|Bounding Box coords| C[✂️ Face Extraction & Preprocessing]
C -->|Normalized 48x48 Image| D[🧠 CNN Emotion Classifier]
D -->|Softmax Probabilities| E[📊 Visualization Engine]
B -.->|Pass Frame| E
E -->|Annotated Frame| F[🖥️ Display / UI]
classDef input fill:#e1f5fe,stroke:#0288d1,stroke-width:2px,color:#000;
classDef process fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000;
classDef model fill:#e8f5e9,stroke:#388e3c,stroke-width:2px,color:#000;
classDef output fill:#fce4ec,stroke:#c2185b,stroke-width:2px,color:#000;
class A input;
class B,C process;
class D model;
class E,F output;
| Language Python 3.8+ |
Computer Vision OpenCV 4.x |
Deep Learning TensorFlow / Keras |
Data Science NumPy, Pandas |
FaceSentrix is trained to recognize the 7 universal facial expressions.
| Emotion | Visual | Description | Application Example |
|---|---|---|---|
| Angry | 😡 | Eyebrows down, lips pressed | Customer frustration tracking |
| Disgust | 🤢 | Wrinkled nose, raised upper lip | Product reaction testing |
| Fear | 😨 | Raised eyebrows, tensed lips | Safety & threat assessment |
| Happy | 😊 | Smiling, raised cheeks | UX & Satisfaction monitoring |
| Sad | 😢 | Frowning, lowered eyes | Mental well-being screening |
| Surprise | 😮 | Widened eyes, open mouth | Content engagement metrics |
| Neutral | 😐 | Relaxed facial muscles | Baseline behavioral context |
FaceSentrix/
├── 📄 README.md # Main project README
├── 📄 LICENSE # CC0 1.0 Universal License
├── 📄 .gitignore # Git ignore rules
├── 📄 requirements.txt # Python dependencies
├── 📂 data/ # Dataset handling (raw & processed)
├── 📂 models/ # Saved CNN models (.h5, .tflite)
├── 📂 src/ # Core Source Code (Detector, Classifier, Visualizer)
├── 📂 training/ # Training scripts and preprocessing
├── 📂 notebooks/ # Jupyter exploration & analysis notebooks
├── 📂 tests/ # Unit & integration testing
├── 📂 assets/ # Project visual assets
├── 📂 docs/ # Extensive internal documentation
└── 📂 app/ # Deployment apps (Web/API)For detailed insights into specific parts of the project, check out our comprehensive docs:
- 👉 Project Roadmap (TODO): Step-by-step feature tracker.
- 👉 System Architecture: Deep dive into data flow and module design.
- 👉 Model Design: CNN structure, parameters, and tuning.
- 👉 Dataset Guide: FER-2013 processing and imbalance handling.
- 👉 Deployment Options: API, Web App, Docker, and Edge instructions.
# 1. Clone the repository
git clone https://github.com/algorithnicmind/FaceSentrix.git
cd FaceSentrix
# 2. Setup Virtual Environment
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
# 3. Install Dependencies
pip install -r requirements.txt
# 4. Run the Real-Time Camera Detection
python src/camera.pyFaceSentrix follows a rigorous "commit-per-change" workflow. Every logical step, file creation, or code adjustment is isolated into its own granular git commit. This method ensures an atomic, reversible, and highly readable development history.
Built with ❤️ by AlgorithmicMind