👁️ EmpVision

Smart Biometric Attendance System

An intelligent high-performance workforce intelligence system utilizing YOLOv8 and FaceNet to manage real-time video enrollments and attendance.

🏗️ System Architecture & Design

The project follows a scalable MVC (Model-View-Controller) architecture to ensure clean code separation and maintainability. A high-level overview of the Client-Server-Database logic handles user registration and daily video check-ins gracefully.

EmpVision/
│
├── .streamlit/
│   └── config.toml
│
├── app/
│   ├── __init__.py
│   ├── core/               # ⚙️ Config & Database connection
│   │   ├── config.py
│   │   └── database.py
│   ├── models/             # 🗄️ Database Schemas (SQLAlchemy)
│   │   └── employee.py
│   ├── services/           # 🧠 AI Logic (Face Recognition & Detection)
│   │   └── face_logic.py
│   ├── controllers/        # 🎮 API Route Handlers
│   │   └── auth_controller.py
│   └── main.py             # 🚀 Application Entry Point (FastAPI)
│
├── frontend.py             # 🎨 Streamlit Dashboard (The UI)
├── .env                    # 🔒 Environment Variables
├── environment.yml         # 📦 Conda Dependencies
└── README.md               # 📖 Documentation

🚀 Usage & Installation

1. Prerequisites & Environment

Uses strict Conda dependency management (environment.yml) running natively or via WSL 2. PostgreSQL is configured for robust concurrent data persistence.

2. Backend Engine (Terminal 1)

FastAPI acts as the deep-learning orchestrator handling video streams via uvicorn app.main:app --reload.

3. Frontend Dashboard (Terminal 2)

The visual UI launches via streamlit run frontend.py, enabling immediate cross-origin configuration mapped dynamically to the API.

4. Remote Edge Access

Supports instant LAN or WAN mirroring via Ngrok tunnels, streaming the reactive dashboard directly to mobile devices without latency delays.

🗺️ Strategic Roadmap (v2.0)

From a foundational prototype to a production-ready intelligence network.

Phase 1: Database Migration & Integrity

Migrated from SQLite to PostgreSQL. SQLite inherently struggles with morning rush-hour concurrency limitations. PostgreSQL fully mitigates this risk while providing robust security.
Implemented strict Pydantic Schemas (v2) validating deep profile configurations (Regex Emails, E.164 Phone constraints) linking arrays into a functional mini-HR directory via SQLAlchemy.

Phase 2: AI Core Overhaul & Intelligent Logic

YOLOv8 Consolidation: Replaced outdated rigid HOG estimators and MTCNNs with an ultralytics unified YOLOv8 pipeline. This handles 90° face profiles and terrible lighting natively natively via CPU inference pipelines connected to ResNet embeddings.
Passive Video Enrollment: Shifted away from static photos. Registration seamlessly initiates a webcam feed, automatically scoring blur factors (Laplacian Variance) and capturing only the 5 "optimal" face frames asynchronously. RTSP integration enabled actual IP-camera simulation.

Phase 3: Security & Anti-Spoofing

Standard biometric systems are easily bypassed with smartphone photographs or tablets playing pre-recorded videos.
Building presentation attack safeguards using Texture/Frequency Liveness analysis and YOLO Landmark active eye-blink tracking to guarantee human presence.

Phase 4 & 5: Scalable Single-Page App & Edge Deployment

React & Cloud Edge: Transitioning away from Streamlit to a full React/Next.js frontend. Backend remains decoupled and Dockerized onto AWS EC2 instances alongside RDS stores.
Hardware Integration: Deploying the minimized YOLOv8n module directly onto Edge Raspberry Pi 5 sensors. The Pi processes frames natively and only transmits light-weight 512-dimensional vector payloads to the cloud, dropping bandwidth overhead to almost zero.