Revolutionizing classroom attendance with Face Recognition and Voice Authentication
ClassSense is an AI-powered attendance system that uses face recognition and voice biometrics to automate classroom attendance. Teachers can snap a photo of their classroom or record audio, and the system automatically identifies enrolled students using trained ML models.
Traditional attendance methods are slow, error-prone, and easy to game. ClassSense solves this with:
- Face Recognition β Upload classroom photos, AI identifies every student instantly
- Voice Authentication β Students say "I am present," and the system matches their voice
- QR-Based Enrollment β Students scan a QR code to join a class in seconds
- Dual Portals β Separate dashboards for teachers and students
Classroom Photo β dlib Face Detector β 128-D Face Embeddings β SVM Classifier β Student Identity
- Detection: dlib's HOG-based frontal face detector locates all faces in the image
- Embedding: Each face is converted to a 128-dimensional descriptor using dlib's ResNet-based face recognition model
- Classification: A Linear SVM (with class balancing) trained on enrolled students' embeddings predicts identity
- Thresholding: L2 distance threshold of 0.6 rejects unknown faces to minimize false positives
Audio Recording β 16kHz Resampling β VAD Segmentation β Resemblyzer Embeddings β Cosine Similarity β Speaker Match
- Preprocessing: Audio is resampled to 16kHz using librosa
- Segmentation: Voice Activity Detection (VAD) with
top_db=30splits audio into individual speech segments - Embedding: Each segment is encoded into a speaker embedding using Resemblyzer's pretrained encoder
- Matching: Cosine similarity against stored embeddings with a threshold of 0.65 identifies the speaker
- AI Face Attendance β Upload/capture multiple classroom photos, run face analysis across all images
- Voice Roll-Call β Record classroom audio for voice-based attendance
- Subject Management β Create subjects with unique codes and sections
- QR Code Sharing β Generate QR codes and shareable links for student enrollment
- Attendance Records β View historical attendance with per-session statistics
- FaceID Login β No passwords needed; students log in with their face
- Voice Enrollment β Optional voice profile registration for voice-based attendance
- Subject Enrollment β Join classes via subject code or QR scan
- Attendance Tracking β View personal attendance stats per subject
- Students: Biometric login via face recognition (camera-based)
- Teachers: Traditional username/password with bcrypt hashing
| Component | Technology |
|---|---|
| Frontend | Streamlit |
| Backend/Database | Supabase (PostgreSQL) |
| Face Detection | dlib (HOG + CNN) |
| Face Embeddings | dlib ResNet (128-D descriptors) |
| Face Classification | scikit-learn SVM (Linear, class-balanced) |
| Voice Embeddings | Resemblyzer (GE2E pretrained encoder) |
| Audio Processing | librosa (resampling, VAD, segmentation) |
| QR Code Generation | segno |
| Password Hashing | bcrypt |
| Deployment | Streamlit Cloud |
ClassSense/
βββ app.py # Main entry point
βββ requirements.txt # Python dependencies
βββ .gitignore
β
βββ src/
βββ components/ # UI Components
β βββ header.py # App header with logo
β βββ footer.py # App footer
β βββ subject_card.py # Subject display card
β βββ dialog_add_photo.py # Camera/upload dialog
β βββ dialog_attendance_results.py # Results review dialog
β βββ dialog_create_subject.py # New subject dialog
β βββ dialog_enroll.py # Student enrollment dialog
β βββ dialog_auto_enroll.py # QR-based auto enrollment
β βββ dialog_share_subject.py # QR code sharing dialog
β βββ dialog_voice_attendance.py # Voice attendance dialog
β
βββ database/ # Database layer
β βββ config.py # Supabase client setup
β βββ db.py # All CRUD operations
β
βββ pipelines/ # ML Pipelines
β βββ face_pipeline.py # Face detection, embedding, SVM training & prediction
β βββ voice_pipeline.py # Voice embedding, speaker identification
β
βββ screens/ # App screens
β βββ home_screen.py # Landing/role selection
β βββ teacher_screen.py # Teacher dashboard & auth
β βββ student_screen.py # Student dashboard & FaceID login
β
βββ ui/ # Styling
βββ base_layout.py # Global CSS and theming
- Python 3.11
- A Supabase project with the required tables
-
Clone the repository
git clone https://github.com/iam-teju/ClassSense.git cd ClassSense -
Create a virtual environment
conda create -n attendance python=3.11 conda activate attendance
-
Install dependencies
pip install -r requirements.txt
-
Set up secrets
Create
.streamlit/secrets.toml:SUPABASE_URL = "your-supabase-url" SUPABASE_KEY = "your-supabase-anon-key"
-
Run the app
streamlit run app.py
The app uses the following Supabase tables:
teachersβteacher_id,username,password(hashed),namestudentsβstudent_id,name,face_embedding(128-D vector),voice_embeddingsubjectsβsubject_id,subject_code,name,section,teacher_idsubject_studentsβstudent_id,subject_id(enrollment junction table)attendance_logsβstudent_id,subject_id,timestamp,is_present
| Decision | Rationale |
|---|---|
| SVM over KNN/deep learning | Works well with small per-class samples (1 embedding per student); linear kernel is fast and interpretable |
| L2 distance threshold (0.6) | Balances false acceptance vs false rejection for face matching |
| Cosine similarity for voice (0.65) | Standard metric for speaker verification with embedding models |
| librosa VAD (top_db=30) | Effectively segments individual speakers in classroom audio |
| Streamlit over Flask/React | Rapid prototyping with built-in camera, audio, and data display widgets |
| Supabase over Firebase | PostgreSQL with real-time capabilities; better for relational data like attendance logs |
- Live App: class-sense-ai.streamlit.app
- Landing Page: classsense-ai.vercel.app
- Landing Page Repo: ClassSense-Landing-Page
Tejas Manoj
Built as an AI/ML portfolio project demonstrating end-to-end machine learning system design β from biometric data capture to real-time inference and deployment.
This project is licensed under the MIT License β see the LICENSE file for details.