Skip to content

iam-teju/ClassSense

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ ClassSense β€” AI-Powered Attendance System

Revolutionizing classroom attendance with Face Recognition and Voice Authentication

Live App Landing Page License Python


πŸ“Œ Overview

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.

Why ClassSense?

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

🧠 How It Works

Face Recognition Pipeline

Classroom Photo β†’ dlib Face Detector β†’ 128-D Face Embeddings β†’ SVM Classifier β†’ Student Identity
  1. Detection: dlib's HOG-based frontal face detector locates all faces in the image
  2. Embedding: Each face is converted to a 128-dimensional descriptor using dlib's ResNet-based face recognition model
  3. Classification: A Linear SVM (with class balancing) trained on enrolled students' embeddings predicts identity
  4. Thresholding: L2 distance threshold of 0.6 rejects unknown faces to minimize false positives

Voice Authentication Pipeline

Audio Recording β†’ 16kHz Resampling β†’ VAD Segmentation β†’ Resemblyzer Embeddings β†’ Cosine Similarity β†’ Speaker Match
  1. Preprocessing: Audio is resampled to 16kHz using librosa
  2. Segmentation: Voice Activity Detection (VAD) with top_db=30 splits audio into individual speech segments
  3. Embedding: Each segment is encoded into a speaker embedding using Resemblyzer's pretrained encoder
  4. Matching: Cosine similarity against stored embeddings with a threshold of 0.65 identifies the speaker

✨ Features

πŸ‘¨β€πŸ« Teacher Portal

  • 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

πŸ‘¨β€πŸŽ“ Student Portal

  • 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

πŸ” Authentication

  • Students: Biometric login via face recognition (camera-based)
  • Teachers: Traditional username/password with bcrypt hashing

πŸ› οΈ Tech Stack

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

πŸ“ Project Structure

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

πŸš€ Getting Started

Prerequisites

  • Python 3.11
  • A Supabase project with the required tables

Installation

  1. Clone the repository

    git clone https://github.com/iam-teju/ClassSense.git
    cd ClassSense
  2. Create a virtual environment

    conda create -n attendance python=3.11
    conda activate attendance
  3. Install dependencies

    pip install -r requirements.txt
  4. Set up secrets

    Create .streamlit/secrets.toml:

    SUPABASE_URL = "your-supabase-url"
    SUPABASE_KEY = "your-supabase-anon-key"
  5. Run the app

    streamlit run app.py

πŸ—„οΈ Database Schema

The app uses the following Supabase tables:

  • teachers β€” teacher_id, username, password (hashed), name
  • students β€” student_id, name, face_embedding (128-D vector), voice_embedding
  • subjects β€” subject_id, subject_code, name, section, teacher_id
  • subject_students β€” student_id, subject_id (enrollment junction table)
  • attendance_logs β€” student_id, subject_id, timestamp, is_present

πŸ“Š Key Technical Decisions

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

πŸ”— Links


πŸ‘€ Author

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.


πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.

About

AI-powered attendance system using Face Recognition (dlib + SVM) and Voice Authentication (Resemblyzer). Built with Streamlit and Supabase.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages