Skip to content

theYsnS/face-recognition-security

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Face Recognition Security System

Python OpenCV FastAPI License: MIT

AI-powered face recognition system for security and access control. Features real-time face detection, recognition with persistent identity database, REST API for integration, and comprehensive access logging.

Features

  • Real-time Detection: MTCNN/HOG-based face detection from camera feeds
  • Face Recognition: 128-dimensional face encoding with configurable matching threshold
  • Identity Database: SQLite-backed face database with CRUD operations
  • REST API: FastAPI endpoints for registration, recognition, and log access
  • Access Logging: Timestamped logs of all recognition events with CSV export
  • Multi-mode: Webcam live mode, API server mode, batch registration mode

Architecture

┌──────────┐     ┌──────────────┐     ┌──────────────┐
│  Camera   │────▶│ FaceDetector │────▶│ FaceEncoder  │
│  / Image  │     │ (MTCNN/HOG)  │     │ (128-d)      │
└──────────┘     └──────────────┘     └──────┬───────┘
                                              │
┌──────────┐     ┌──────────────┐     ┌───────▼──────┐
│  Logger   │◀───│  Recognizer  │◀───▶│   Database   │
│  (CSV)    │     │  (Matching)  │     │  (SQLite)    │
└──────────┘     └──────────────┘     └──────────────┘
                        │
                  ┌─────▼─────┐
                  │  FastAPI   │
                  │  REST API  │
                  └───────────┘

API Endpoints

Method Endpoint Description
POST /register Register a new face with name and image
POST /recognize Recognize faces in uploaded image
GET /persons List all registered persons
DELETE /persons/{id} Remove a registered person
GET /logs Get access/recognition logs

Installation

git clone https://github.com/theYsnS/face-recognition-security.git
cd face-recognition-security
pip install -r requirements.txt

Usage

# Start API server
python main.py --mode api --port 8000

# Live webcam recognition
python main.py --mode webcam

# Register faces from directory
python main.py --mode register --faces-dir ./known_faces/

License

MIT License - see LICENSE for details.

About

AI-powered face recognition system for security and access control with real-time detection and REST API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages