Skip to content

Aakash-2005/Face-Recognition-Gate-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

🚪 Face Recognition Gate System 2.0

An AI-powered, real-time face recognition-based gate access system designed to automate entry and exit management using computer vision.
This project enhances security and attendance tracking by combining Python, OpenCV, and MySQL for efficient facial identification and data logging.
Developed by Aakash Kumar Jha.


🚀 Features

  • Real-time Face Recognition: Detects and identifies registered faces through a live camera feed.
  • Automatic Entry & Exit Tracking: Maintains an accurate log of all individuals entering and exiting the premises.
  • Database Integration (MySQL): Stores all user records and gate logs securely.
  • Live Camera Feed: Displays the real-time recognition process with visual confirmation.
  • Access Control: Automatically grants or denies entry based on recognition confidence.
  • Comprehensive Logging: Every recognition event is time-stamped and saved for auditing.
  • Modular Design: Easy to scale, customize, or integrate with IoT-based gate systems.
  • Error Handling: Built-in safety checks for camera and database connections.

🧰 Tech Stack

  • Language: Python 3.10+
  • Libraries: OpenCV, face_recognition, NumPy, Pandas
  • Database: MySQL
  • Framework (optional): Flask (for dashboard integration)
  • Operating System: Windows 10/11 (tested)

📋 Requirements

  • Python 3.10+
  • MySQL Server
  • Webcam or external camera
  • Windows 10/11

Install required dependencies:

pip install -r requirements.txt

🛠️ Installation

  1. Clone the Repository

    git clone https://github.com/Aakash-2005/Face-Recognition-Gate-System.git
    cd Face-Recognition-Gate-System
  2. Install Dependencies

    pip install -r requirements.txt
  3. Set up MySQL Database

    • Create a database named face_gate_system
    • Configure database credentials in config.py (if available)
  4. Run the Application

    python main.py

🎯 Usage

Starting the System

  • Launch main.py
  • The system initializes the camera, loads stored face encodings, and connects to the database.

Recognition Process

  1. The camera detects a face.
  2. The system compares it with the stored database encodings.
  3. If matched, the user is marked as “Authorized” and entry is logged.
  4. If not matched, the system displays “Unrecognized Face.”

🗄️ Database Structure

Table: users

Column Type Description
id INT Unique user ID
name VARCHAR Name of the individual
face_encoding BLOB Encoded face data
access_status VARCHAR Current access state

Table: gate_logs

Column Type Description
log_id INT Log entry ID
name VARCHAR Recognized name
time_stamp DATETIME Date and time of recognition
action VARCHAR Entry/Exit status

🖥️ User Interface

  • Live Video Feed: Displays real-time recognition camera view.
  • Recognition Result Panel: Shows user name, recognition confidence, and gate status.
  • Log Panel: Displays historical access data fetched from MySQL.

🎨 UI Highlights

  • Clean and modern interface using Tkinter (optional).
  • Visual indicators for “Authorized” (green) and “Denied” (red).
  • Automatic refresh for real-time updates.

🔍 Face Recognition Logic

  1. Detection: OpenCV captures frames from the camera.
  2. Encoding: face_recognition library extracts facial embeddings.
  3. Comparison: Embeddings compared with stored encodings.
  4. Decision: If confidence ≥ threshold (default 0.5), grant access.

📊 Logging

All activities are logged both in the console and MySQL database, including:

  • Successful recognitions
  • Unknown face attempts
  • System or camera errors

⚙️ Configuration

Edit config.py to modify:

  • MySQL credentials
  • Recognition threshold
  • Camera index
  • Logging level

🔮 Future Enhancements

  • Integration with IoT-enabled gate motors
  • Addition of liveness detection (anti-spoofing)
  • Multi-camera support
  • Cloud synchronization and dashboard analytics
  • Notification system for unknown face attempts

⚠️ Troubleshooting

Camera not working?

  • Ensure no other app is using the webcam.
  • Try changing the camera index in main.py.

Database not connecting?

  • Check MySQL service is running.
  • Verify credentials in config.py.

Face not recognized?

  • Ensure proper lighting.
  • Retrain and save clear face samples.

📈 Performance

  • Optimized frame processing for faster recognition.
  • Efficient memory handling to prevent lags.
  • Batch encoding for multiple users.

👨‍💻 Developer

Aakash Kumar Jha Passionate about Artificial Intelligence, Computer Vision, and automation. Focused on developing practical AI-based solutions for real-world problems.


📜 License

Open-source project for educational and research purposes. © 2025 Aakash Kumar Jha. All rights reserved.

Version: 2.0 Last Updated: November 2025

About

AI-based face recognition gate system for secure access control

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages