GitHunt
RP

RpM-999/P14-Facial-Recognition-Based-Attendance-System

The Facial Recognition Based Attendance System is an automated solution designed to streamline attendance management in educational institutions. By utilizing advanced facial recognition technology, the system eliminates manual attendance processes, reduces proxy attendance, and provides real-time attendance tracking with comprehensive reporting .

๐ŸŽ“ Facial Recognition Based Attendance System

A comprehensive attendance management system that leverages facial recognition technology to automate student attendance tracking. Built with Streamlit, FaceNet-PyTorch, and integrated with Supabase, Qdrant Vector Database, and Google Sheets for efficient data management.


๐ŸŽฏ Overview

The Facial Recognition Based Attendance System is an automated solution designed to streamline attendance management in educational institutions. By utilizing advanced facial recognition technology, the system eliminates manual attendance processes, reduces proxy attendance, and provides real-time attendance tracking with comprehensive reporting capabilities.

Key Highlights

  • โœ… Real-time Facial Recognition using FaceNet deep learning model
  • โœ… Multi-user Admin Panel for system management
  • โœ… Department-wise Student Management
  • โœ… Automated Email Notifications for registration and reports
  • โœ… Google Sheets Integration for attendance logging
  • โœ… Vector Database for fast and accurate face matching
  • โœ… Comprehensive Reporting with attendance analytics

โœจ Features

๐Ÿ‘จโ€๐Ÿ’ผ Admin Features

  • Secure Admin Authentication: Role-based access control with email and password authentication
  • Department Management: Add, update, and manage departments with HOD information
  • Student Management:
    • Add new students with facial data registration
    • Update student information
    • Remove students from the system
    • View student profiles by department
  • Admin Management: Add and remove admin users
  • Attendance Reports: Generate and email department-wise attendance reports to HODs

๐Ÿ“ธ Attendance Features

  • Live Facial Recognition: Capture and match faces in real-time
  • Automatic Attendance Logging: Records attendance with timestamp to Google Sheets
  • High Accuracy Matching: Uses FaceNet embeddings with cosine similarity for precise identification
  • Duplicate Prevention: Prevents multiple check-ins on the same day
  • Attendance List View: View and filter attendance records

๐Ÿ“ง Notification System

  • Registration Emails: Automatic welcome emails to students upon registration
  • Report Emails: Periodic attendance reports sent to department HODs

๐Ÿ›  Technology Stack

Frontend

  • Streamlit: Web application framework for the user interface

Machine Learning

  • FaceNet-PyTorch: Pre-trained FaceNet model for face embeddings
  • PyTorch: Deep learning framework
  • MTCNN: Multi-task Cascaded Convolutional Networks for face detection

Databases

  • Supabase: Relational database for structured data (students, departments, admins)
  • Qdrant: Vector database for storing and querying face embeddings

Integrations

  • Google Sheets API: Real-time attendance logging via gspread
  • SMTP Email: Automated email notifications

Additional Libraries

  • Pillow (PIL): Image processing
  • Pandas: Data manipulation and analysis
  • pytz: Timezone handling

๐Ÿ— System Architecture

1. Student Registration
2. Give Attendance
3. Generate Attendance & send to HOD's mail

๐Ÿ— Database Architecture

1. Relational Database
2. Vector Database

๐Ÿ“ฆ Prerequisites

Before you begin, ensure you have the following installed:

  • Python 3.8+: Download Python
  • pip: Python package installer
  • Git: Version control system
  • Virtual Environment: venv or conda

Required Accounts

  1. Supabase Account: For MySQL database (Sign up)
  2. Qdrant Cloud or Local Instance: For vector database (Documentation)
  3. Google Cloud Console: For Google Sheets API (Console)
  4. SMTP Email Service: Gmail or other SMTP provider

๐Ÿš€ Installation

Step 1: Clone the Repository

git clone https://github.com/yourusername/facial-recognition-attendance-system.git
cd facial-recognition-attendance-system

Step 2: Create Virtual Environment

# Using venv
python -m venv venv

# Activate virtual environment

venv\Scripts\activate       # On Windows

source venv/bin/activate    # On macOS/Linux:

Step 3: Install Dependencies

pip install -r requirements.txt

Requirements include:

  • streamlit
  • facenet-pytorch
  • torch
  • supabase
  • pillow
  • gotrue
  • qdrant-client
  • gspread
  • google-auth
  • pytz

โš™๏ธ Configuration

1. Database Configuration

Supabase Setup

Create a file BACKEND/RDB_connection_OP.py with your Supabase credentials:

import supabase

SUPABASE_URL = "your_supabase_url"
SUPABASE_KEY = "your_supabase_anon_key"

def get_supabase_client():
    return supabase.create_client(SUPABASE_URL, SUPABASE_KEY)

Qdrant Vector Database Setup

Create a file BACKEND/VDB_connection_OP.py with your Qdrant configuration:

from qdrant_client import QdrantClient

QDRANT_URL = "your_qdrant_url"
QDRANT_API_KEY = "your_qdrant_api_key"

def get_qdrant_client():
    return QdrantClient(url=QDRANT_URL, api_key=QDRANT_API_KEY)

2. Google Sheets API Setup

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable Google Sheets API
  4. Create service account credentials
  5. Download the JSON key file
  6. Share your Google Sheet with the service account email
  7. Place the JSON file in the FUNC/ directory and reference it in your code

3. Email Configuration

Configure SMTP settings in FUNC/send_email.py:

SMTP_SERVER = "smtp.gmail.com"
SMTP_PORT = 587
SENDER_EMAIL = "your_email@gmail.com"
SENDER_PASSWORD = "your_app_password"  # Use app-specific password for Gmail

4. Database Tables

Create the following tables in your Supabase database:

App Controls Table

CREATE TABLE app_controls (
    is_registration_open BOOLEAN NOT NULL DEFAULT FALSE
);

Departments Table:

CREATE TABLE department (
    dep_id TEXT PRIMARY KEY,
    dep_name TEXT NOT NULL,
    dep_hod TEXT NOT NULL,
    dep_hod_mail TEXT NOT NULL
);

Students Table:

CREATE TABLE students (
    s_id TEXT PRIMARY KEY,
    s_name TEXT NOT NULL,
    s_mail TEXT UNIQUE NOT NULL,
    s_phone TEXT NOT NULL,
    s_address TEXT,
    dep_id TEXT NOT NULL,
    s_admissionyear INT NOT NULL,
    s_dob DATE NOT NULL,

    CONSTRAINT fk_department
        FOREIGN KEY (dep_id)
        REFERENCES department(dep_id)
        ON UPDATE CASCADE
        ON DELETE RESTRICT
);

๐Ÿ“ Project Structure

P14-Facial-Recognition-Based-Attendance-System-main/
โ”‚
โ”œโ”€โ”€ app.py                          # Main Streamlit application entry point
โ”œโ”€โ”€ requirements.txt                # Python dependencies
โ”œโ”€โ”€ README.md                       # Project documentation
โ”œโ”€โ”€ project details.md              # Additional project information
โ”‚
โ”œโ”€โ”€ BACKEND/                        # Backend operations and database connections
โ”‚   โ”œโ”€โ”€ admin_OP.py                 # Admin authentication and operations
โ”‚   โ”œโ”€โ”€ attendance_OP.py            # Attendance logging and identification
โ”‚   โ”œโ”€โ”€ department_OP.py            # Department CRUD operations
โ”‚   โ”œโ”€โ”€ RDB_connection_OP.py        # Relational database (Supabase) connection
โ”‚   โ”œโ”€โ”€ report_OP.py                # Report generation and email dispatch
โ”‚   โ”œโ”€โ”€ student_OP.py               # Student CRUD operations
โ”‚   โ””โ”€โ”€ VDB_connection_OP.py        # Vector database (Qdrant) connection
โ”‚
โ”œโ”€โ”€ FUNC/                           # Functional modules and utilities
โ”‚   โ”œโ”€โ”€ attendance_gspread.py       # Google Sheets attendance operations
โ”‚   โ”œโ”€โ”€ face_embedding_OP.py        # Face detection and embedding generation
โ”‚   โ”œโ”€โ”€ g_spread.py                 # General Google Sheets operations
โ”‚   โ”œโ”€โ”€ navigation.py               # Page navigation helper
โ”‚   โ””โ”€โ”€ send_email.py               # Email notification service
โ”‚
โ”œโ”€โ”€ UI/                             # Streamlit UI pages
โ”‚   โ”œโ”€โ”€ Home.py                     # Landing page
โ”‚   โ”œโ”€โ”€ Admin_login.py              # Admin authentication page
โ”‚   โ”œโ”€โ”€ Admin_option.py             # Admin dashboard
โ”‚   โ”œโ”€โ”€ Add_new_department.py       # Department creation page
โ”‚   โ”œโ”€โ”€ Update_department_info.py   # Department update page
โ”‚   โ”œโ”€โ”€ Add_new_student.py          # Student registration page
โ”‚   โ”œโ”€โ”€ Update_student_info.py      # Student update page
โ”‚   โ”œโ”€โ”€ Remove_student.py           # Student removal page
โ”‚   โ”œโ”€โ”€ Give_attendance.py          # Live attendance capture page
โ”‚   โ”œโ”€โ”€ Attendance_list.py          # Attendance records viewer
โ”‚   โ”œโ”€โ”€ Add_admin.py                # Admin creation page
โ”‚   โ””โ”€โ”€ Remove_admin.py             # Admin removal page
โ”‚
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ IMAGES/                         # Static images and assets

๐ŸŽฎ Usage

Starting the Application

streamlit run app.py

The application will open in your default web browser at http://localhost:8501

Admin Workflow

  1. Login: Navigate to Admin Login and enter credentials
  2. Manage Departments:
    • Add new departments with HOD details
    • Update existing department information
  3. Manage Students:
    • Register new students with facial data
    • Update student information
    • Remove students when needed
  4. View Attendance: Check attendance records by date and department
  5. Generate Reports: Create and email attendance reports to HODs

Student Attendance Workflow

  1. Navigate to Give Attendance page
  2. Allow camera access
  3. Capture live image
  4. System automatically identifies and logs attendance
  5. Confirmation message displayed upon successful check-in

๐Ÿ”‘ Key Modules

Face Embedding Module (FUNC/face_embedding_OP.py)

  • Uses MTCNN for face detection
  • Generates 512-dimensional embeddings using FaceNet
  • Handles image preprocessing and normalization

Student Operations (BACKEND/student_OP.py)

  • process_and_upload_students(): Batch student registration with face embeddings
  • get_student_by_id(): Retrieve student information
  • update_student_info(): Update student details
  • find_student_by_embedding(): Facial recognition matching using Qdrant
  • delete_student(): Remove student and associated embeddings

Attendance Operations (BACKEND/attendance_OP.py)

  • identify_student_from_image(): Real-time face recognition
  • log_attendance_to_sheet(): Record attendance in Google Sheets
  • Uses cosine similarity with threshold for accurate matching

Report Generation (BACKEND/report_OP.py)

  • generate_and_send_reports(): Create attendance reports with statistics
  • Calculates attendance percentage
  • Sends HTML-formatted emails to department HODs

๐Ÿ’พ Database Schema

Students Collection (RDB - supabase )

  • Student ID (Primary Key)
  • Name
  • Email
  • Phone no.
  • Address
  • Department ID (Foreign Key)
  • Admision year
  • date od birth

Departments (RDB - supabase )

  • Department ID (Primary Key)
  • Department Name
  • HOD Name
  • HOD Email

Student Registratio App Control (RDB- supabase )

  • is registration open (Primary Key)
1. Relational Database

Face Embeddings (VDB - Qdrant)

  • Vector ID
  • Student ID (payload)
  • 512-dimensional face embedding vector
  • Metadata (name, department)
2. Vector Database

Attendance Log (Google Sheets)

  • Date
  • Student ID
  • Department ID
3. Attendance Log

๐Ÿ”— API Integration

Supabase REST API

  • Student and department CRUD operations
  • Admin authentication

Qdrant Vector Search API

  • Face embedding storage
  • Cosine Similarity search for face matching

Google Sheets API

  • Real-time attendance logging
  • Data retrieval for reports

๐Ÿ”’ Security

  • Password Hashing: Admin passwords should be hashed (implement bcrypt)
  • Environment Variables: Store sensitive credentials in .env file (not in source code)
  • Session Management: Streamlit session state for authentication
  • API Keys: Secure API keys for external services
  • Input Validation: Sanitize all user inputs
  • HTTPS: Use HTTPS in production for data transmission
# Supabase
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key

# Qdrant
QDRANT_URL=your_qdrant_url
QDRANT_API_KEY=your_qdrant_key

# Email
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SENDER_EMAIL=your_email@gmail.com
SENDER_PASSWORD=your_app_password

# Google Sheets
GOOGLE_SHEETS_CREDS=path/to/credentials.json

๐Ÿ› Troubleshooting

Common Issues

1. Camera Access Denied

  • Check browser permissions for camera access
  • Ensure HTTPS is used in production

2. Face Not Detected

  • Ensure proper lighting conditions
  • Face should be clearly visible and frontal
  • Check if MTCNN model is loaded correctly

3. Database Connection Error

  • Verify database credentials in configuration files
  • Check internet connection
  • Ensure database services are running

4. Import Errors

  • Ensure all dependencies are installed: pip install -r requirements.txt
  • Check Python version compatibility (3.8+)

5. Email Not Sending

  • Verify SMTP credentials
  • Enable "Less secure app access" or use app-specific password for Gmail
  • Check firewall settings

๐Ÿ–ผ๏ธ Screenshots

Fig-1 : Home Page

Landing Page Admin Choose Admin Login and Student Choose Give Attendence Section

Fig-2 : Admin Login

Admin login interface for authorized access to administrative privileges.

Fig-3 : Admin Panel

Admin panel dashboard providing centralized access to system management features.

Fig-4 : Student Registration Control

Open Form: Enables student registration and stores data in Google Sheets.
Close Form: Disables student registration to prevent new submissions.

Fig-5 : Student data upload to database

Student information from Google Sheet upload to RDB( Supabase ) and student Face Embedding upload to VDB( Quadrant )

Fig-6 : Student registration confirmation

Confirmation email received after successful student registration, including system-generated Student ID (email ID hidden for security purposes)

Fig-7 : Update student information and face embedding

Students can update personal information and regenerate face embeddings by uploading three clear images in cases where initial registration images were unclear or face recognition fails

Fig-8 : Remove student from system

Admin confirmation interface for permanently deleting a studentโ€™s records when the student leaves the institution, including removal of data from RDB (Supabase) and facial embeddings from VDB (Qdrant)

Fig-9 : Add a new department

Admin interface for adding a new department by entering department ID, department name, Head of Department (HOD) details, and official email information

Fig-10 : Update department information

Admin interface for modifying existing department details, including department name, Head of Department (HOD) information, and official email address

Fig-11 : Attendance list and reporting

Interface for generating attendance reports within a selected date range, calculating effective working days, and automatically sending department-wise reports to the respective HODs via email

Fig-12 : Attendance report email notification

Automatically generated attendance report emailed to the respective Head of Department (HOD), including reporting period, total working days, student-wise attendance details, and attendance percentage

Fig-13 : Face-Recognition based attendance marking

Student attendance interface using real-time face capture, where attendance can be marked only within a predefined time window configured by college administrators

Fig-14 : Attendance confirmation before write in attendance-log

Confirmation interface displayed after successful face recognition, allowing the student to verify their identity before final attendance is logged into the system

Fig-15 : Attendance data storage

**Student attendance records stored in Google Sheets, including date-wise entries with student ID and department ID for further reporting and analysis

๐Ÿ“Š Project Status

๐Ÿšง Active Development - This project is actively maintained and open for contributions.

Roadmap

  • Multi-language support
  • [โœ…] Mobile application
  • Advanced analytics dashboard
  • Biometric integration
  • Cloud deployment guide
  • Docker containerization
  • API documentation
  • Unit test coverage

๐Ÿ™ Acknowledgments

  • FaceNet: For the pre-trained facial recognition model
  • Streamlit: For the amazing web framework
  • Qdrant: For the efficient vector database
  • Supabase: For the database infrastructure
  • Google: For Sheets API integration

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ“ง Contact

Project Maintainer: [Rupam Mondal]

  • ๐Ÿ“ง Email: Mail
  • ๐Ÿ™ GitHub: Link
  • ๐Ÿ’ผ LinkedIn: Link

Project Link: https://github.com/yourusername/facial-recognition-attendance-system


โญ If you find this project helpful, please consider giving it a star โญ


Last Updated: December 2025

Languages

Python100.0%

Contributors

MIT License
Created October 19, 2025
Updated February 25, 2026
RpM-999/P14-Facial-Recognition-Based-Attendance-System | GitHunt