Skip to content

Daku3011/Auto-Attendance-System-ASP.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

32 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ“ Auto Attendance System

AI-Powered Facial Recognition Attendance for Modern Classrooms

ASP.NET Core PostgreSQL OpenCV ONNX Runtime SignalR License: MIT


A production-ready web application that automates classroom attendance using deep-learning face recognition. Capture a photo, detect every face in the frame, and instantly mark attendance โ€” all in real time.


๐Ÿง  How It Works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ๐Ÿ“ธ Camera  โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  YuNet ONNX  โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  ArcFace (ONNX)   โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ ๐Ÿ” Cosine      โ”‚
โ”‚  Capture    โ”‚     โ”‚  Detection   โ”‚     โ”‚  512-D Embedding   โ”‚     โ”‚    Similarity   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                                            โ”‚
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ–ผ
               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
               โ”‚ ๐ŸŽฏ Match Against  โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ โœ… Mark          โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ ๐Ÿ“ก SignalR       โ”‚
               โ”‚    Student DB     โ”‚     โ”‚    Attendance     โ”‚     โ”‚    Broadcast     โ”‚
               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  1. Capture โ€” A photo is taken from a browser webcam or an RTSP IP camera.
  2. Detect โ€” The YuNet ONNX model locates every face in the frame.
  3. Embed โ€” Each cropped face is passed through ArcFace (InsightFace) to produce a 512-dimensional embedding.
  4. Match โ€” Embeddings are compared against stored student embeddings using Cosine Similarity (threshold โ‰ฅ 0.65).
  5. Record โ€” Attendance is saved to the database with duplicate-prevention logic.
  6. Broadcast โ€” SignalR pushes the result instantly to every connected dashboard.

โœจ Features

Category Feature
๐Ÿค– AI Engine ArcFace (InsightFace) 512-D embeddings via ONNX Runtime
๐Ÿ‘๏ธ Face Detection YuNet ONNX โ€” fast, multi-face, rotation-robust
โšก Real-time Updates SignalR WebSocket broadcasts for live attendance feed
๐Ÿ” Security ASP.NET Core Identity ยท Role-based access ยท CSRF protection
๐Ÿ“Š Reports Filter by Classroom / Faculty / Date Range ยท CSV export
๐Ÿ“น Capture Sources Browser webcam + RTSP IP camera support
๐Ÿง‘โ€๐ŸŽ“ Student CRUD Full student profile management with multi-photo upload
๐Ÿ”„ Auto Training Background model retraining when new photos are added
๐Ÿ›ก๏ธ Duplicate Guard Configurable time window to prevent re-marking

๐Ÿ› ๏ธ Technology Stack

Layer Technology
Framework ASP.NET Core 8.0 MVC (C#)
Database PostgreSQL ยท Entity Framework Core 8
Face Detection YuNet ONNX model
Face Recognition ArcFace (InsightFace) ONNX model via Microsoft.ML.OnnxRuntime
Image Processing OpenCvSharp4 (.NET wrapper for OpenCV)
Real-time ASP.NET Core SignalR
Auth ASP.NET Core Identity
Frontend Bootstrap 5 ยท Custom glassmorphism CSS ยท JavaScript
Version Control Git ยท Git LFS (for ONNX model files)

๏ฟฝ Project Structure

Auto-Attendance-System-ASP.NET/
โ”œโ”€โ”€ readme.md                       โ† You are here
โ”œโ”€โ”€ Report.pdf                      โ† Project report
โ””โ”€โ”€ DemoAttendanceSystem/
    โ”œโ”€โ”€ .gitignore
    โ”œโ”€โ”€ .gitattributes               โ† Git LFS tracking rules
    โ”œโ”€โ”€ README.md                    โ† Technical documentation
    โ””โ”€โ”€ DemoAAS/
        โ”œโ”€โ”€ Controllers/
        โ”‚   โ”œโ”€โ”€ AttendanceController.cs    โ† Capture, recognize, mark
        โ”‚   โ”œโ”€โ”€ StudentsController.cs      โ† Student CRUD + photo upload
        โ”‚   โ””โ”€โ”€ HomeController.cs          โ† Landing page
        โ”œโ”€โ”€ Services/
        โ”‚   โ”œโ”€โ”€ FacialRecognitionService.cs โ† Core recognition pipeline
        โ”‚   โ””โ”€โ”€ ArcFaceEmbeddingService.cs  โ† ONNX inference wrapper
        โ”œโ”€โ”€ Hubs/
        โ”‚   โ””โ”€โ”€ AttendanceHub.cs           โ† SignalR real-time hub
        โ”œโ”€โ”€ Models/
        โ”‚   โ”œโ”€โ”€ Student.cs
        โ”‚   โ”œโ”€โ”€ StudentPhoto.cs            โ† Includes FaceEmbedding field
        โ”‚   โ””โ”€โ”€ Attendance.cs
        โ”œโ”€โ”€ Data/
        โ”‚   โ””โ”€โ”€ ApplicationDbContext.cs
        โ”œโ”€โ”€ Views/                         โ† Razor views (MVC)
        โ”œโ”€โ”€ arcface.onnx                   โ† ArcFace model (Git LFS)
        โ”œโ”€โ”€ face_detection_yunet.onnx      โ† YuNet model (Git LFS)
        โ””โ”€โ”€ Program.cs

๐Ÿš€ Getting Started

Prerequisites

Requirement Version
.NET SDK 8.0+
PostgreSQL 14+
Docker 24.0+ (optional)
Docker Compose 2.0+ (optional)

| Git LFS | 3.0+ (for cloning ONNX models) |

Installation

# 1. Install Git LFS (required for ONNX model files)
git lfs install

# 2. Clone the repository
git clone https://github.com/Daku3011/Auto-Attendance-System-ASP.NET.git
cd Auto-Attendance-System-ASP.NET/DemoAttendanceSystem

3. Configure the database โ€” Edit DemoAAS/appsettings.json:

"ConnectionStrings": {
  "DefaultConnection": "Host=localhost;Database=DemoAAS;Username=postgres;Password=your_password"
}
# 4. Apply database migrations
dotnet ef database update --project DemoAAS

# 5. Run the application
dotnet run --project DemoAAS

๐Ÿณ Docker Deployment (Recommended)

Run the entire stack (App + Database) with one command:

# Build and start services
docker-compose up --build -d

# View logs
docker-compose logs -f

The application will be available at http://localhost:8080.

๐ŸŒ Open your browser at https://localhost:5001 (or the port shown in the terminal).


๐Ÿ“‹ Usage Guide

Step 1 โ€” Register Students

Navigate to Students โ†’ Create New. Enter the student's details and upload 3โ€“5 clear, front-facing photos per student. The system will automatically extract and store face embeddings.

Step 2 โ€” Take Attendance

Go to the Attendance page. Click Start Camera, position students in the frame, and hit Capture & Mark Attendance. The system detects all faces, matches them, and logs attendance instantly.

Step 3 โ€” Monitor in Real Time

Recognized students appear in the live sidebar via SignalR โ€” no page refresh needed. Connected dashboards update automatically.

Step 4 โ€” Export Reports

Visit Attendance Records โ†’ filter by Classroom, Faculty, or Date Range โ†’ click Export CSV.


๐Ÿ”ฎ Roadmap

  • ArcFace (InsightFace) deep-learning embeddings
  • SignalR real-time attendance broadcasts
  • ASP.NET Core Identity authentication
  • Continuous "Live Mode" scanning without manual capture
  • Attendance analytics dashboard with charts
  • Docker containerization for one-command deployment
  • Mobile-responsive PWA for tablet kiosks

About

Real-time face recognition attendance system with ArcFace + YuNet, built on ASP.NET Core, PostgreSQL, and SignalR for fast, secure, automated classroom tracking.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors