Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Face Recognition Attendance System

A high-performance real-time attendance management system leveraging state-of-the-art facial recognition technology. Designed to automate student attendance tracking with exceptional accuracy, even in challenging scenarios like identical twins and varied facial angles.

📸 System Overview

This system captures real-time video feeds, detects and recognizes faces instantly, and automatically marks attendance in a PostgreSQL database. It's built with a modern tech stack that prioritizes speed, accuracy, and scalability.

Key Achievement: Successfully distinguished 38 out of 40 twin pairs while maintaining accurate detection across all face orientations.

🚀 Tech Stack

Frontend

  • Next.js 16 - React framework with server-side rendering
  • TypeScript - Type-safe development
  • TailwindCSS - Utility-first styling for responsive UI

Backend

  • FastAPI - High-performance Python web framework
  • OpenCV - Real-time image capture and preprocessing
  • PostgreSQL + pgvector - Database with vector similarity search

AI/ML Core

  • InsightFace - Deep learning face analysis
  • Buffalo_M Model - Face embedding generation
  • scikit-learn - Cosine similarity computation for face matching

✨ Key Features

🎯 High-Accuracy Face Recognition

  • Twin Differentiation: Successfully identifies 95% of identical twins (38/40 pairs)
  • Multi-Angle Detection: Reliable face detection from front, profile, and angled positions
  • Real-time Processing: Instant face capture, embedding generation, and matching

📊 Intelligent Attendance Management

  • Automated Marking: Touch-free attendance via facial recognition
  • Vector Similarity Search: Efficient face matching using pgvector extensions
  • Attendance Analytics: Track patterns, late arrivals, and attendance history

🔒 Robust & Scalable Architecture

  • Anti-Spoofing Ready: Foundation for liveness detection
  • Scalable Vector Database: Handles thousands of face embeddings
  • RESTful API: Easy integration with existing systems

🛠️ Installation

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • PostgreSQL 14+ with pgvector extension
  • Camera/Webcam access

Backend Setup

cd server
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -r requirements.txt

# Download InsightFace model
python -c "from insightface.app import FaceAnalysis; FaceAnalysis(name='buffalo_m')"

# Setup database
createdb attendance_db
psql attendance_db -c "CREATE EXTENSION vector;"
alembic upgrade head

# Run server
uvicorn app.main:app --reload

Frontend Setup

cd client
npm install
npm run dev

Database Migration

# Create pgvector extension
psql -d attendance_db -c "CREATE EXTENSION IF NOT EXISTS vector;"

# Run migrations
cd server
alembic upgrade head

📊 Performance Metrics

Metric Result
Twin Detection Rate 95% (38/40 pairs)
Multi-Angle Accuracy 100%
Avg Recognition Time < 200ms
False Acceptance Rate < 0.1%
Concurrent Users Support 50+

🏗️ System Architecture

┌─────────────┐     ┌──────────────┐     ┌────────────────┐
│  Next.js    │────▶│   FastAPI    │────▶│  PostgreSQL    │
│  Frontend   │     │   Backend    │     │  + pgvector    │
└─────────────┘     └──────────────┘     └────────────────┘
                           │
                    ┌──────▼──────┐
                    │   OpenCV    │
                    │   Camera    │
                    └──────┬──────┘
                           │
                    ┌──────▼──────┐
                    │ InsightFace │
                    │ Buffalo_M   │
                    └─────────────┘

📝 API Endpoints

Method Endpoint Description
POST /auth/register Register new student with face
POST /auth/mark-attendance Capture & mark attendance
GET /attendance/report Generate attendance reports
GET /students/{id} Get student details

🔍 How It Works

  1. Face Registration: Students register their facial data which gets converted to 512-dimensional embeddings
  2. Real-time Capture: Camera captures frames at 30 FPS
  3. Face Detection: InsightFace detects and extracts faces from frames
  4. Embedding Generation: Buffalo_M model generates embeddings
  5. Vector Search: pgvector performs similarity search against stored embeddings
  6. Attendance Marking: Match above threshold → Attendance marked with timestamp

🎯 Use Cases

  • Educational Institutions: Automated classroom attendance
  • Corporate Offices: Employee time tracking
  • Events & Conferences: Attendee management
  • Secure Facilities: Access control systems

🚧 Future Enhancements

  • Liveness detection to prevent spoofing
  • Mask detection support
  • Mobile app integration
  • Real-time dashboard with WebSocket
  • Export attendance reports (PDF/Excel)
  • Multi-camera support
  • Emotion and attention analysis

About

Students attendance marking system that uses facial recognition capabilities for realtime identification and recognition through deep learning

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages