Skip to content

zoolpher/class-scan

Repository files navigation

ClassScan 🎓

Python Flask DeepFace OpenCV TensorFlow

AI-powered face recognition attendance system.
Register students once. Mark attendance automatically. Export instantly.

Features · Demo · Installation · Usage · Tech Stack


Overview

ClassScan is a web-based attendance management system that uses face recognition to automatically identify students from classroom photos and generate attendance reports as downloadable CSV files.

Faculty takes a few photos of the class from different angles, uploads them to the system, and within minutes a complete attendance sheet — with every student marked present or absent — is ready to download.


Features

  • Multi-photo Registration — Students register using 5–10 photos for maximum recognition accuracy across different angles and lighting conditions
  • Live Camera Capture — Students can take selfies directly in the browser without uploading files
  • Batch Attendance Processing — Faculty uploads multiple class photos; results are merged automatically, eliminating duplicates
  • Instant CSV Export — Attendance report downloads automatically with roll number, name, status, time, and date
  • Student Dashboard — View all registered students with registration details
  • Database Management — Clear student database or attendance records independently with confirmation prompts
  • Fully Local — No cloud, no external APIs, no data leaves your machine

Demo

http://localhost:5000/           →  Home Dashboard
http://localhost:5000/register   →  Student Registration
http://localhost:5000/attendance →  Take Attendance
http://localhost:5000/students   →  View All Students

Attendance Output

Roll No Name Status Time Date
101 Garry Singh P 09:32 2026-03-20
102 RDJ Kumar P 09:32 2026-03-20
103 Jack Sharma A - 2026-03-20

How It Works

REGISTRATION
────────────
Student opens /register
       ↓
Takes 5–10 selfies via browser camera
       ↓
DeepFace generates face embeddings (128 numbers per photo)
       ↓
Embeddings are averaged → one unified face signature
       ↓
Saved to local JSON database


ATTENDANCE
──────────
Faculty uploads 3–5 class photos from different angles
       ↓
System detects all faces in each photo
       ↓
Each face is encoded → compared against database
       ↓
Closest match below threshold → marked PRESENT
No match found → marked ABSENT
       ↓
Results merged across all photos (no duplicates)
       ↓
CSV downloaded automatically

Tech Stack

Layer Technology
Language Python 3.11
Web Framework Flask
Face Recognition DeepFace (Facenet model)
Image Processing OpenCV
ML Backend TensorFlow / Keras
Database JSON (local file)
Frontend HTML, CSS, Vanilla JS
Camera Access WebRTC (browser native)

Installation

Prerequisites

  • Python 3.11
  • pip
  • Git
  • A webcam or phone camera

Setup

1. Clone the repository

git clone https://github.com/yourusername/ClassScan.git
cd ClassScan

2. Create virtual environment

py -3.11 -m venv attendance_env
attendance_env\Scripts\activate        # Windows
source attendance_env/bin/activate     # Mac/Linux

3. Install dependencies

pip install -r requirements.txt

⚠️ First install may take 5–10 minutes. DeepFace downloads the Facenet model (~90MB) on first run.

4. Create required folders

mkdir dataset encodings attendance static\uploads templates

5. Run the app

python app.py

6. Open in browser

http://localhost:5000

Usage

Register a Student

  1. Go to /register
  2. Enter student name and roll number
  3. Click Open Camera and take 5–10 selfies
  4. Click Register Student
  5. Student is now in the system

💡 More photos = better accuracy. Vary angles and expressions.

Take Attendance

  1. Faculty takes 3–5 photos of the classroom from different angles
  2. Go to /attendance
  3. Upload all class photos
  4. Click Process Attendance
  5. CSV downloads automatically

Manage Records

  • View all registered students at /students
  • Clear Database — removes all student registrations
  • Clear Attendance — removes all generated CSV files

Project Structure

ClassScan/
│
├── app.py                  ← Flask web application
├── register.py             ← Student registration logic
├── recognize.py            ← Face recognition + attendance logic
├── utils.py                ← Shared database utilities
├── requirements.txt        ← Python dependencies
│
├── templates/
│   ├── index.html          ← Home page
│   ├── register.html       ← Registration form with camera
│   ├── attendance.html     ← Attendance upload form
│   └── students.html       ← Student management dashboard
│
├── static/
│   └── uploads/            ← Temporary uploaded files
│
├── dataset/                ← Student registration photos
│   └── {roll_no}/          ← One folder per student
│
├── encodings/
│   └── database.json       ← Face embeddings database
│
└── attendance/             ← Generated attendance CSV files

Configuration

You can adjust recognition sensitivity in recognize.py:

# Lower = stricter matching (fewer false positives)
# Higher = more lenient matching (fewer missed detections)
THRESHOLD = 10

Recommended values:

  • 8–10 — High accuracy environment (controlled lighting)
  • 10–12 — Normal classroom environment
  • 12–15 — Low light or varied angles

Important Notes

  • All data is stored locally on your machine. Nothing is uploaded to any server.
  • Student photos in dataset/ and encodings/database.json contain biometric data. Do not share or commit these files.
  • The .gitignore excludes all sensitive data by default.

Requirements

flask
deepface
opencv-python
numpy
tf-keras
werkzeug

License

MIT License — feel free to use, modify and distribute.


Built with Python · DeepFace · Flask

About

AI-powered face recognition attendance system

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors