Skip to content

About

AI-powered campus management system with real-time facial recognition attendance, YOLO person tracking, course management, and analytics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

53 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ“ TechPhantom AI Campus

AI-Powered Campus Management System with Real-Time Facial Recognition Attendance

TechPhantom AI Campus is a modern, full-stack Campus Management System (CMS) designed to automate university operations through Artificial Intelligence, Computer Vision, real-time attendance tracking, and centralized academic management.

The core of the platform is its AI-powered facial recognition attendance system, which combines face detection, 128-dimensional facial embeddings, identity recognition, and YOLO-based person tracking to provide an automated alternative to traditional manual attendance.

๐Ÿš€ From student registration to facial enrollment, classroom detection, identity verification, and attendance recording โ€” TechPhantom AI Campus brings the complete workflow into one intelligent platform.


โญ What Makes This Project Different?

Unlike a conventional CMS that only manages student records and attendance manually, TechPhantom AI Campus introduces an AI Computer Vision layer directly into the attendance workflow.

๐Ÿค– AI Facial Recognition Attendance

The attendance engine is built around a multi-stage computer vision pipeline:

                ๐Ÿ“ท Camera / Video Stream
                         โ”‚
                         โ–ผ
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚  YOLO Detection  โ”‚
                โ”‚ Person Detection โ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
                         โ–ผ
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚ Face Detection   โ”‚
                โ”‚   & Processing   โ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
                         โ–ผ
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚ Face Encoding    โ”‚
                โ”‚    128D Vector   โ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
                         โ–ผ
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚ Identity Match   โ”‚
                โ”‚ Student Database โ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
                         โ–ผ
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚ Course / Session โ”‚
                โ”‚    Validation    โ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
                         โ–ผ
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚ Attendance Saved โ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ฅ Key AI Capabilities

  • Real-time facial recognition
  • 128D facial embeddings
  • YOLO-based person detection and tracking
  • Student identity verification
  • Face enrollment through the student profile
  • Multi-student detection
  • Course-aware attendance validation
  • Duplicate attendance prevention
  • Active-class/course selection logic
  • Real-time attendance events through WebSockets
  • OpenCV-based image preprocessing
  • Fallback encoding support for environments where native C++ dependencies are unavailable

The YOLO tracking layer is particularly useful for video-stream scenarios because object trackers can maintain tracked identities across frames.


๐Ÿš€ Core Features

๐Ÿค– 1. AI Facial Recognition Attendance

The centerpiece of TechPhantom AI Campus.

Students can register their facial data once, after which the system can recognize them during attendance sessions.

Attendance Workflow

  1. Student enrolls their face.
  2. The system generates a facial representation.
  3. Camera captures the classroom/session.
  4. YOLO detects people in the video stream.
  5. Face detection identifies visible faces.
  6. Facial embeddings are generated.
  7. Embeddings are compared with enrolled students.
  8. The system identifies the student.
  9. Active course/session rules are evaluated.
  10. Attendance is recorded.
  11. The result is pushed to connected dashboards in real time.

Why YOLO + Face Recognition?

The system separates "Who is present in the camera?" from "Who is this person?"

YOLO
 โ†“
Detect / Track Person
 โ†“
Face Detection
 โ†“
Face Encoding
 โ†“
Face Matching
 โ†“
Student Identity
 โ†“
Attendance Validation

This architecture helps make the attendance kiosk suitable for real-time environments rather than relying on a simple single-face image upload.


๐Ÿ“Š 2. Administrative Dashboard

Administrators get a centralized control panel for managing the entire campus system.

Dashboard capabilities

  • ๐Ÿ“ˆ Attendance analytics
  • ๐Ÿ‘จโ€๐ŸŽ“ Student statistics
  • ๐Ÿ“š Course statistics
  • ๐Ÿ“Š Attendance percentages
  • ๐Ÿ‘ค Student management
  • ๐ŸŽ“ Course management
  • ๐Ÿง‘โ€๐Ÿ’ป User management
  • ๐Ÿค– Face enrollment management
  • ๐Ÿ“ก Live attendance monitoring
  • ๐Ÿ”Ž Attendance history
  • ๐Ÿ” Role-based access control

๐Ÿ‘จโ€๐ŸŽ“ 3. Student Portal

Students have their own dedicated portal to interact with the academic system.

Student capabilities

  • View attendance history
  • View attendance percentage
  • Check course enrollment
  • Enroll in available courses
  • Update profile information
  • Register facial data
  • Review attendance records

๐Ÿ“š 4. Course Management

Administrators can create and manage university courses.

Course functionality

  • Create courses
  • Update courses
  • Delete courses
  • Assign course information
  • Manage active courses
  • Associate students with courses
  • Validate attendance against active courses

The system also includes multi-course logic, allowing the attendance workflow to handle students who are enrolled in multiple active classes.


๐Ÿ“ก 5. Real-Time Attendance Kiosk

TechPhantom AI Campus includes a global scanner/kiosk mode designed for high-traffic environments.

The kiosk can continuously process camera input while the backend communicates attendance events to connected clients through WebSockets.

Camera
   โ”‚
   โ–ผ
AI Processing
   โ”‚
   โ–ผ
FastAPI Backend
   โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ Database
   โ”‚
   โ–ผ
WebSocket
   โ”‚
   โ–ผ
Live Dashboard

FastAPI supports WebSocket endpoints for persistent two-way communication between the application and connected clients.


๐Ÿง  AI & Computer Vision Architecture

The computer vision subsystem combines multiple technologies instead of relying on a single model.

Face Recognition

Powered by:

  • face_recognition
  • dlib
  • 128-dimensional facial embeddings

The facial recognition component converts detected faces into numerical representations that can be compared against enrolled student data.

Object Detection & Tracking

Powered by:

  • Ultralytics YOLO
  • OpenCV

YOLO provides real-time person detection/tracking while OpenCV handles camera and image-processing operations.

Ultralytics supports tracking on video and streaming sources and provides configurable tracking systems such as BoT-SORT and ByteTrack.

Hybrid Compatibility

The project also includes a fallback approach for environments where native C++ dependencies required by dlib cannot be built easily.

Primary
dlib + face_recognition
        โ”‚
        โ–ผ
High-quality facial embeddings

Fallback
OpenCV-based processing
        โ”‚
        โ–ผ
Improved environment compatibility

๐Ÿ—๏ธ System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  FRONTEND                    โ”‚
โ”‚                                              โ”‚
โ”‚        React.js + Vite + Vanilla CSS         โ”‚
โ”‚                                              โ”‚
โ”‚  Admin Dashboard โ”‚ Student Portal โ”‚ Kiosk   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚
                   REST / WebSocket
                        โ”‚
                        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  BACKEND                     โ”‚
โ”‚                                              โ”‚
โ”‚                 FastAPI                     โ”‚
โ”‚                                              โ”‚
โ”‚ Authentication โ”‚ Students โ”‚ Courses          โ”‚
โ”‚ Attendance โ”‚ Analytics โ”‚ WebSockets          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚                  โ”‚
                โ–ผ                  โ–ผ
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚   Database     โ”‚   โ”‚  AI / Vision    โ”‚
       โ”‚                โ”‚   โ”‚                 โ”‚
       โ”‚ SQLAlchemy     โ”‚   โ”‚ YOLO            โ”‚
       โ”‚ SQLite/Postgresโ”‚   โ”‚ OpenCV          โ”‚
       โ”‚ MySQL          โ”‚   โ”‚ face_recognitionโ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚ dlib            โ”‚
                            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ Technology Stack

Backend

Technology Purpose
Python Core backend & AI processing
FastAPI REST API framework
SQLAlchemy Database ORM
Pydantic Data validation
Uvicorn ASGI server
JWT Authentication
Bcrypt Password hashing

Frontend

Technology Purpose
React.js UI framework
Vite Frontend tooling
Vanilla CSS Custom UI design
Lucide Icons Interface icons
WebSocket Real-time communication

AI & Computer Vision

Technology Purpose
face_recognition Facial recognition
dlib Facial embeddings
OpenCV Image processing & camera handling
Ultralytics YOLO Person detection & tracking

Database

  • SQLite โ€” local development
  • PostgreSQL โ€” production
  • MySQL โ€” supported through SQLAlchemy

๐Ÿ“‚ Project Structure

TechPhantom-AI-Campus/
โ”‚
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”œโ”€โ”€ schemas/
โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”œโ”€โ”€ ai/
โ”‚   โ”‚   โ”œโ”€โ”€ face_recognition/
โ”‚   โ”‚   โ”œโ”€โ”€ detection/
โ”‚   โ”‚   โ””โ”€โ”€ tracking/
โ”‚   โ”œโ”€โ”€ database/
โ”‚   โ””โ”€โ”€ requirements.txt
โ”‚
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ””โ”€โ”€ assets/
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ vite.config.js
โ”‚
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ docker-compose.yml

โš™๏ธ Installation & Setup

Prerequisites

Make sure you have:

  • Python 3.9+
  • Node.js 18+
  • npm
  • C++ Build Tools
  • Git
  • Webcam/camera for facial attendance

dlib and face_recognition may require native build dependencies depending on your operating system and Python environment.


๐Ÿ”ง Backend Setup

cd backend

python -m venv venv

Windows

.\venv\Scripts\activate

Linux / macOS

source venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Start the backend:

python main.py

Or with Uvicorn:

uvicorn main:app --reload

๐Ÿ’ป Frontend Setup

cd frontend
npm install
npm run dev

The frontend will start using Vite's development server.


๐Ÿ” Environment Configuration

Create:

backend/.env

Example:

DATABASE_URL=sqlite:///./attendance.db

SECRET_KEY=your_very_secure_random_secret

ALGORITHM=HS256

ACCESS_TOKEN_EXPIRE_MINUTES=1440

For production, replace development secrets and SQLite with appropriate production configuration.


๐Ÿงช How to Use the Demo (Quick Start)

Want to test the facial recognition attendance system right away? Follow these steps:

1. Login as Admin

  1. Open the application.
  2. Click the "Demo Admin" button on the login screen.
  3. You are now logged into the Administrative Dashboard.

2. Create a Course & Session

  1. Navigate to Courses in the sidebar.
  2. Click "Add Course", enter a name (e.g., "AI 101"), and save.
  3. Navigate to Attendance Sessions.
  4. Click "New Session", select your newly created course, and start it. (The scanner only marks attendance for active sessions).

3. Enroll the Demo Student & Register Face

  1. Navigate to Students in the sidebar.
  2. You will see a pre-created "Demo Student". Click the Edit icon (pencil).
  3. Under Enrolled Courses, select the course you just created and click Save.
  4. Click the Face Registration icon (camera) next to the Demo Student.
  5. Upload a clear picture of your face. (This saves your facial embedding to the database).

4. Test the Scanner!

  1. Navigate to the Live Kiosk from the sidebar.
  2. Allow camera permissions.
  3. Step in front of the camera.
  4. The system will detect your face, match it against the registered demo student, check the active session, and mark you as Present with a green success message!

๐Ÿงช Facial Attendance Setup

Before using automated attendance in a real-world scenario:

1. Create Student

Administrator creates a student profile.

2. Enroll Face

The student registers their face through the system.

Student Profile
       โ†“
Face Capture
       โ†“
Face Detection
       โ†“
Face Encoding
       โ†“
Store Facial Representation

3. Start Attendance Kiosk

Launch the camera/kiosk.

Camera โ†’ YOLO โ†’ Face Detection โ†’ Encoding โ†’ Matching

4. Identify Student

The system compares the detected facial representation against enrolled students.

5. Validate Course

The system determines the appropriate active course/session.

6. Record Attendance

A successful recognition results in an attendance record.


๐Ÿ“ˆ Attendance Intelligence

The platform is designed to provide more than a simple Present/Absent value.

Attendance data can be used to calculate:

  • Individual attendance percentage
  • Course attendance percentage
  • Student attendance history
  • Class/session attendance
  • Overall campus attendance statistics
  • Attendance trends

Example:

Student: Muhammad Ali
Course: Artificial Intelligence

Total Classes: 30
Present:       26
Absent:         4

Attendance: 86.67%

๐Ÿ”’ Security

TechPhantom AI Campus implements multiple layers of application security.

Authentication

  • JWT-based authentication
  • Secure password hashing
  • Token expiration

Authorization

Role-based access control separates administrative and student functionality.

API Security

  • Protected API endpoints
  • Configurable CORS
  • Input validation through Pydantic
  • Authentication middleware/dependencies

Facial Data

The system is designed to store facial representations/encodings rather than relying on raw student photographs for recognition.

โš ๏ธ Facial biometric data is sensitive. A production deployment should additionally implement appropriate consent, retention, access-control, encryption, and institutional privacy policies.


๐Ÿš€ Production Deployment

For production environments, the recommended architecture is:

                   Internet
                      โ”‚
                      โ–ผ
                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                  โ”‚ Nginx โ”‚
                  โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜
                      โ”‚
             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
             โ–ผ                 โ–ผ
        React Frontend     FastAPI API
                                โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ–ผ           โ–ผ           โ–ผ
                PostgreSQL    AI Engine   WebSocket

Recommended Infrastructure

  • 4 GB+ RAM
  • 2+ vCPUs
  • Linux server
  • Nginx
  • PostgreSQL
  • HTTPS/SSL
  • Gunicorn + Uvicorn workers
  • GPU recommended for heavier computer-vision workloads

Example:

gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app

For larger deployments, Docker Compose can be used to orchestrate:

  • FastAPI
  • React/Nginx
  • PostgreSQL
  • AI processing services

๐Ÿ“Š Example Use Cases

๐Ÿซ Universities

Automate classroom attendance without requiring manual roll calls.

๐ŸŽ“ Classrooms

Use a camera-based kiosk to recognize students entering or attending a session.

๐Ÿข Campus Entry Points

Deploy the system at designated campus scanning locations.

๐Ÿ“ก High-Traffic Areas

Use the live kiosk and tracking system for continuous attendance processing.


๐Ÿ”ฎ Future Improvements

Potential extensions include:

  • Liveness / anti-spoofing detection
  • Mobile attendance notifications
  • Advanced attendance analytics
  • Email/SMS alerts for low attendance
  • GPU-accelerated inference
  • Cloud deployment
  • Multi-campus support
  • Advanced audit logs
  • Facial recognition confidence thresholds
  • Attendance anomaly detection
  • Parent/guardian portal
  • Automated timetable integration
  • Containerized AI inference service

๐ŸŽฏ Project Highlights

๐Ÿค– AI-Powered Facial Recognition
๐ŸŽฅ Real-Time Computer Vision
๐Ÿ‘๏ธ YOLO Person Detection & Tracking
๐Ÿง  128D Facial Embeddings
๐Ÿ“ก Real-Time WebSocket Attendance
๐ŸŽ“ Automated Course Management
๐Ÿ“Š Administrative Analytics
๐Ÿ‘จโ€๐ŸŽ“ Student Portal
๐Ÿ” JWT + RBAC Security
โšก FastAPI Backend
โš›๏ธ React + Vite Frontend
๐Ÿ—„๏ธ SQLAlchemy Database Layer
๐Ÿณ Production-Ready Architecture

๐Ÿ“Œ Why TechPhantom AI Campus?

Traditional campus management systems primarily focus on record keeping.

TechPhantom AI Campus focuses on automation.

Instead of:

Teacher โ†’ Manual Roll Call โ†’ Attendance Sheet โ†’ Database

TechPhantom introduces:

Camera
   โ†“
AI Detection
   โ†“
Facial Recognition
   โ†“
Student Identification
   โ†“
Course Validation
   โ†“
Automatic Attendance
   โ†“
Real-Time Dashboard

This makes AI-powered facial attendance the central intelligence layer of the campus management platform.


๐Ÿ† Project Summary

TechPhantom AI Campus combines:

Full-Stack Development + Artificial Intelligence + Computer Vision + Real-Time Systems + Database Engineering

into a unified university management platform.

The project's primary innovation is its real-time facial recognition attendance pipeline, supported by YOLO-based person detection/tracking, dlib/face-recognition facial embeddings, OpenCV processing, FastAPI APIs, and WebSocket communication.

It demonstrates how modern AI technologies can be integrated into a practical university information system to automate repetitive administrative workflows while providing students and administrators with a centralized digital platform.


๐Ÿ‘จโ€๐Ÿ’ป TechPhantom

Built with Python, FastAPI, React, Computer Vision, and AI.

โญ If you find this project useful, consider giving the repository a star.


๐Ÿ“„ License

This project is intended for educational, research, and demonstration purposes. Add your preferred license here, such as MIT, if the repository is intended for open-source distribution.

About

AI-powered campus management system with real-time facial recognition attendance, YOLO person tracking, course management, and analytics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages