Classroom Pulse is a comprehensive, AI-driven classroom management platform built for Smart India Hackathon 2025 (SIH '25). It integrates real-time mood & engagement analysis, face-recognition-based automated attendance, geofenced QR attendance, a faculty LMS dashboard, and video conferencing into a single unified system β enabling data-driven teaching and enhanced student engagement.
π Built for SIH 2025 β Solving real-time classroom monitoring and intelligent attendance management at scale.
- Architecture Overview
- Key Features
- Modules
- Tech Stack
- Project Structure
- Installation
- Usage
- Detection & Analysis Pipeline
- API Endpoints
- Screenshots
- Team
- License
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Faculty LMS Dashboard (React + Vite) β
β Timetable β Attendance β Marks β Mood Analytics β Reports β
ββββββββββββ¬βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β REST / SSE β
ββββββββββββΌβββββββββββ βββββββββββββββΌβββββββββββββββββββββββββββββββββββ
β QR Attendance β β Classroom Pulse Backend β
β (Flask + ngrok) β β (FastAPI / Flask) β
β β β β
β βββββββββββββββββ β β ββββββββββββββββ ββββββββββββββββββββββββββ β
β β QR Generation β β β β YOLOv8-Face β β FER / DeepFace β β
β β + Geofencing β β β β Detection ββββΆβ Emotion Recognition β β
β β (Haversine) β β β ββββββββββββββββ ββββββββββββββββββββββββββ β
β βββββββββββββββββ β β ββββββββββββββββ ββββββββββββββββββββββββββ β
β β β β MediaPipe β β Engagement Scoring β β
β β β β FaceMesh ββββΆβ (Valence / Arousal) β β
β β β ββββββββββββββββ ββββββββββββββββββββββββββ β
β β β ββββββββββββββββ ββββββββββββββββββββββββββ β
β β β β Head Pose β β Yawn / Blink / Gaze β β
β β β β (PnP Solve) ββββΆβ Detection (MAR/EAR) β β
β β β ββββββββββββββββ ββββββββββββββββββββββββββ β
βββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββ
β Video Conferencing β β Smart Kiosk (Face Recognition Attendance) β
β (Express + Jitsi) β β DeepFace SFace + YOLO + Live Analytics UI β
βββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββ
| Feature | Description |
|---|---|
| Real-Time Mood Detection | 7-emotion classification (happy, sad, angry, surprise, fear, disgust, neutral) using FER / DeepFace on live webcam feeds |
| Engagement Index | Weighted Valence-Arousal model producing a 0β100 engagement score with EMA smoothing |
| Head Pose Estimation | PnP-based 3D head pose (pitch, yaw, roll) to detect "Listening" vs. "Looking Down" states |
| Yawn Detection | Mouth Aspect Ratio (MAR) based real-time yawning detection via MediaPipe FaceMesh |
| Blink Detection | Eye Aspect Ratio (EAR) analysis for drowsiness / attention monitoring |
| YOLOv8 Face Detection | Fast, accurate multi-face detection optimized for classroom-scale (50+ faces) |
| Face Recognition Attendance | DeepFace (SFace model) for automatic check-in/check-out via smart kiosk |
| QR + Geofence Attendance | QR code scan with GPS verification (Haversine formula, configurable radius) |
| Faculty LMS Dashboard | React + Vite frontend with timetable, attendance records, marks, and mood analytics views |
| Video Conferencing | Jitsi Meet integration with role-based settings (host/student) and bandwidth optimization |
| Live Video Stream | MJPEG streaming with annotated face boxes, emotion labels, and attention overlays |
| SSE / WebSocket Analytics | Real-time analytics push to frontend dashboards via Server-Sent Events and WebSocket |
| Per-Emotion Headcount Charts | Live Matplotlib bar charts and engagement time-series (standalone mode) |
The core analytics engine that processes live webcam feeds to generate classroom-level mood and engagement metrics.
Two operational modes:
| Mode | File | Face Detection | Server |
|---|---|---|---|
| Standalone (OpenCV Window) | classroom_yolo.py / realtime_pulse_preview.py |
YOLOv8-Face / MediaPipe | None (runs locally with Matplotlib charts) |
| Server Mode (API + Dashboard) | app/main.py + app/pulse.py |
FER built-in detector | FastAPI with WebSocket + MJPEG stream |
Key capabilities:
- Multi-face emotion detection (FER library on per-face crops)
- MediaPipe FaceMesh for 468-landmark tracking
- PnP-based head pose estimation with EMA smoothing
- Yawning detection via Mouth Aspect Ratio (MAR > 0.60)
- Listening / Looking Down classification
- Engagement scoring:
E = 100 Γ (0.5 Γ (happy + surprise) + 0.3 Γ (1 β neutral) + 0.2 Γ arousal) - Real-time Chart.js dashboard via WebSocket push
A classroom-entrance kiosk system that uses DeepFace for automated face-recognition-based attendance.
Pipeline:
Camera Frame
β
ββββΊ YOLOv8-Face β face bounding boxes
β
ββββΊ DeepFace.find() β match against student dataset (SFace model)
β ββββΊ Auto check-in / check-out with cooldown timer
β
ββββΊ DeepFace.analyze() β per-face emotion classification
β
ββββΊ MediaPipe FaceMesh β MAR (yawning) + EAR (blink) detection
Features:
- Automatic student identification from pre-registered face database
- Check-in / check-out with configurable cooldown (default: 5 min)
- Live UI overlay with sidebar showing attendance log and analytics
- Backend sync via REST API for persistent attendance records
A lightweight Flask app for QR-based attendance with GPS geofencing to prevent proxy attendance.
How it works:
- Faculty generates a QR code linked to a public ngrok URL
- Students scan the QR β opens a verification page on their phone
- Browser captures GPS coordinates
- Server validates location using Haversine distance (configurable radius, default: 20m)
- Attendance logged as
PRESENTorABSENTto CSV
A React 18 + Vite + TypeScript single-page application for faculty to manage their classes.
Pages:
| Page | Description |
|---|---|
LoginPage |
Faculty authentication |
DashboardPage |
Timetable grid + upcoming classes overview |
AttendancePage |
Student attendance records and management |
MarksPage |
Marks entry and management |
AnalyticsPage |
Class performance analytics |
MoodAnalyticsPage |
Live mood & engagement visualizations from Classroom Pulse |
Tech: React Router, Tailwind CSS, Recharts, jsPDF + html2canvas for report export.
An Express.js server that wraps Jitsi Meet to provide seamless video conferencing for online/hybrid classes.
Features:
- Room creation with unique IDs (
class-<random>) - Role-based join URLs (host vs. student)
- Auto-configured Jitsi settings: prejoin disabled, students muted by default, 360p bandwidth cap, P2P disabled for stability
| Technology | Purpose |
|---|---|
| YOLOv8n-Face | Fast multi-face detection (Ultralytics) |
| MediaPipe FaceMesh | 468-landmark facial tracking, head pose, MAR/EAR |
| FER | Lightweight 7-emotion classifier |
| DeepFace | Face recognition (SFace) + emotion analysis |
| TensorFlow / Keras | Custom CNN for drowsiness detection (eye/yawn classification) |
| OpenCV | Video capture, frame processing, PnP pose estimation |
| NumPy / SciPy | Numerical computation, Haversine distance |
| Technology | Purpose |
|---|---|
| FastAPI | Classroom Pulse API server (WebSocket + REST) |
| Flask | QR attendance server + Kiosk analytics backend |
| Express.js | Video conferencing room management |
| ngrok | Public URL tunneling for QR attendance |
| Technology | Purpose |
|---|---|
| React 18 | UI framework |
| Vite | Build tool and dev server |
| TypeScript | Type safety |
| Tailwind CSS | Styling |
| Recharts | Data visualization charts |
| Chart.js | Real-time analytics dashboard (Pulse MVP) |
| jsPDF + html2canvas | PDF report generation |
| Axios | HTTP client |
| Technology | Purpose |
|---|---|
| Jitsi Meet | Open-source video conferencing |
| Matplotlib | Standalone analytics charts (OpenCV mode) |
| CSV | Lightweight attendance logging |
classroom-pulse/
β
βββ classroom_pulse_mvp/ # π§ Core real-time analytics module
β βββ app/
β β βββ main.py # FastAPI server (WebSocket, MJPEG, REST)
β β βββ pulse.py # PulseEngine β threaded emotion + engagement pipeline
β β βββ config.py # Tunable parameters (intervals, thresholds, labels)
β β βββ static/
β β βββ index.html # Chart.js real-time dashboard
β βββ classroom_yolo.py # Standalone mode β YOLO + FER + head pose + charts
β βββ realtime_pulse_preview.py # Standalone mode β MediaPipe + FER + charts
β βββ requirements.txt # Python dependencies
β βββ yolov8n-face.pt # YOLOv8 face detection weights
β
βββ github-new/attendance-marker/
β βββ SIH/
β βββ backend/
β β βββ server.py # Flask server β KioskRuntime + MJPEG + SSE analytics
β β βββ app.py # Flask app routes
β β βββ models.py # Data models
β β βββ routes.py # REST API routes
β βββ kiosk/
β β βββ kiosk_app.py # Smart kiosk β DeepFace recognition + live UI
β β βββ register_students.py # Student face enrollment
β β βββ hardware_test.py # Camera/hardware diagnostics
β β βββ students.csv # Registered student records
β βββ requirements.txt # Python dependencies
β
βββ qr-code/ # π± QR-based geofenced attendance
β βββ app.py # Flask server β QR generation + location verification
β βββ qr_utils.py # QR code image generator
β βββ location_utils.py # Haversine distance calculator
β βββ location_logs.csv # Attendance log
β βββ templates/ # HTML templates (index, verify)
β βββ static/ # QR images
β
βββ faculty-lms-frontend/ # π₯ Faculty dashboard (React + Vite)
β βββ src/
β β βββ App.tsx # Router and layout
β β βββ pages/ # Login, Dashboard, Attendance, Marks, Analytics, Mood
β β βββ components/ # Navbar, TimetableGrid, UpcomingClasses, charts
β β βββ context/ # Auth context
β β βββ services/ # API clients
β β βββ router/ # Route configuration
β β βββ types/ # TypeScript type definitions
β βββ package.json
β βββ vite.config.ts
β
βββ video-conferencing/ # π₯ Jitsi-based video conferencing
β βββ server.cjs # Express.js β room creation + join URL generation
β βββ public/ # Static assets
β βββ package.json
β
βββ dataset_new/ # Training data (eye/yawn classification)
β βββ train/
β βββ test/
β
βββ mood_recog.py # π§ͺ CNN training script for drowsiness detection
βββ yolomodel.py # YOLO face weights downloader utility
βββ yolov8n-face.pt # YOLOv8 face detection model weights
βββ kaggle.json # Kaggle API credentials (for dataset downloads)
- Python 3.10+ with
pip - Node.js 18+ with
npm - Webcam (required for real-time analysis)
- GPU (optional, falls back to CPU β recommended for DeepFace)
git clone https://github.com/<your-username>/classroom-pulse.git
cd classroom-pulsecd classroom_pulse_mvp
# Create and activate virtual environment
python -m venv .venv
# Windows
.\.venv\Scripts\activate
# Linux/macOS
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
cd ..cd github-new/attendance-marker/SIH
# Create virtual environment and install
python -m venv .venv
.\.venv\Scripts\activate # Windows
pip install -r requirements.txt
cd ../../..cd qr-code
pip install flask qrcode[pil]
cd ..cd faculty-lms-frontend
npm install
cd ..cd video-conferencing
npm install
cd ..The YOLOv8n-Face weights are auto-downloaded on first run, or you can manually place
yolov8n-face.ptin the relevant directories.
cd classroom_pulse_mvp
python classroom_yolo.pyThis opens a fullscreen camera window with real-time face detection, emotion labels, attention tracking, and live Matplotlib charts showing per-emotion headcount and engagement over time.
Controls:
- Press
Fβ Toggle fullscreen - Press
Qβ Quit
Terminal 1 β Analytics Backend:
cd classroom_pulse_mvp
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reloadTerminal 2 β Faculty Frontend:
cd faculty-lms-frontend
npm run devTerminal 3 β Video Conferencing (optional):
cd video-conferencing
node server.cjs| Service | URL |
|---|---|
| Pulse Dashboard | http://localhost:8000 |
| Camera Preview | http://localhost:8000/preview |
| Live Video Stream | http://localhost:8000/video |
| Analytics Snapshot | http://localhost:8000/snapshot |
| Faculty LMS | http://localhost:5173 |
| Video Conferencing | http://localhost:3000 |
cd qr-code
# Start ngrok (in a separate terminal)
./ngrok-v3-stable-windows-amd64/ngrok http 5000
# Update the public_url in app.py with your ngrok URL, then:
python app.pycd github-new/attendance-marker/SIH
# Terminal 1 β Start the backend
cd backend
python server.py
# Terminal 2 β Start the kiosk
cd kiosk
python kiosk_app.pyWebcam Frame (960Γ540)
β
ββββΊ YOLOv8-Face Detection
β ββββΊ Bounding boxes (padded 10%) for each face
β
ββββΊ FER Emotion Classification (per-face crop)
β ββββΊ Top emotion + confidence score
β ββββΊ Thresholded (conf > 0.40, else β "neutral")
β
ββββΊ MediaPipe FaceMesh (468 landmarks)
β β
β ββββΊ PnP Head Pose (6-point solve)
β β ββββΊ Pitch > 15Β° β "Looking Down"
β β ββββΊ |Pitch| < 10Β° & |Yaw| < 25Β° β "Listening"
β β
β ββββΊ Mouth Aspect Ratio (MAR)
β ββββΊ MAR > 0.60 β "Yawning"
β
ββββΊ Aggregation (every 0.1β0.5s interval)
ββββΊ Per-emotion headcount distribution
ββββΊ Weighted Valence = Ξ£ (weight_i Γ valence_i)
ββββΊ Weighted Arousal = Ξ£ (weight_i Γ arousal_i)
ββββΊ Engagement Index (0β100) with EMA smoothing
Camera Frame
β
ββββΊ YOLO Detect β face boxes
β
ββββΊ DeepFace.find(SFace model) β match against enrolled dataset
β ββββΊ Match found β check-in / check-out (with cooldown)
β ββββΊ POST /api/attendance/log
β
ββββΊ DeepFace.analyze() β dominant emotion per face
β
ββββΊ FaceMesh β yawn count (MAR) + blink count (EAR)
ββββΊ Kiosk UI overlay with live analytics sidebar
Faculty generates QR β Student scans
β
ββββΊ Browser geolocation API β (lat, lon)
β
ββββΊ Haversine distance to classroom center
ββββΊ distance β€ 20m β PRESENT β
ββββΊ distance > 20m β ABSENT β
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Chart.js analytics dashboard |
GET |
/preview |
Live camera preview (MJPEG) |
GET |
/video |
Raw MJPEG video stream |
GET |
/snapshot |
Latest metrics JSON |
GET |
/healthz |
Health check |
WS |
/ws |
WebSocket β real-time metrics push |
Snapshot Response:
{
"emotion_dist": { "happy": 0.45, "neutral": 0.30, "surprise": 0.15, "sad": 0.10 },
"valence": 0.3412,
"arousal": 0.6234,
"engagement": 72.5,
"n_faces": 12,
"timestamp": 1747412345.678
}| Method | Endpoint | Description |
|---|---|---|
GET |
/api/stream |
MJPEG annotated video stream |
GET |
/api/kiosk/analytics/stream |
SSE β real-time analytics events |
GET |
/api/kiosk/analytics/summary |
JSON snapshot of current analytics |
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
QR display page |
GET |
/verify |
Student verification page |
POST |
/store_location |
Submit GPS for attendance verification |
| Method | Endpoint | Description |
|---|---|---|
POST |
/courses/:courseId/meetings |
Create a new Jitsi meeting room |
GET |
/meetings/:id/join-url |
Get role-based join URL |
Screenshots can be added here after deployment.
- Ultralytics YOLOv8 β Object detection framework
- MediaPipe β Face mesh and landmark tracking
- FER β Facial Expression Recognition
- DeepFace β Face recognition and analysis
- Jitsi Meet β Open-source video conferencing
- FastAPI β Modern async Python web framework
- Vite β Next-generation frontend build tool
- Recharts β React charting library
This project is developed for Smart India Hackathon 2025 and academic purposes.
See LICENSE for details.
Built with π by the Classroom Pulse Team β SIH 2025