An AI-powered vehicle entry management system with dual interfaces for staff and administrators. Detects license plates with YOLO, extracts text using PaddleOCR, validates it with a robust Regex layer, and provides comprehensive vehicle tracking with entry/exit management.
Designed for smart gates, parking systems, security checkpoints, and access-controlled facilities.
- YOLOv8-based Plate Detection β Custom-trained for high accuracy on Indian number plates.
- Robust OCR with PaddleOCR β Extracts text from plates, even in challenging conditions.
- Advanced Number Plate Validation β A powerful regex layer cleans raw OCR output (e.g., removes noise like "IND") and validates the text against multiple official Indian formats (Standard, BH-Series, Army, Diplomatic, etc.) to ensure high data accuracy.
- End-to-End Workflow: Image/Video β Detect Plate β Extract Text β Validate & Clean β Log Result.
- Versatile Input β Works with images, videos, and live camera feeds.
- Real-World Ready β Handles glare, skewed angles, and low-light conditions.
SmartVehEntryAI/
β
βββ app.py # Staff interface (FastAPI) with OCR & Regex logic
βββ admin.py # Admin panel (FastAPI)
βββ database.py # Database models and setup
βββ plate_reader.py # Core detection + OCR pipeline
β
βββ detection_model.pt # YOLO model weights
βββ vehicles.db # SQLite database (auto-created)
β
βββ dataset/ # Training / testing data
β βββ train/ # Training images & labels
β βββ val/ # Validation images & labels
β βββ test/ # Test images & labels
β
βββ runs/ # YOLO training outputs (weights, logs)
βββ scripts/ # Utility scripts (e.g., data prep)
βββ static/ # Annotated images (auto-created)
β
βββ requirements.txt # Python dependencies
βββ start.bat # Windows startup script
βββ start.sh # Linux/Mac startup script
βββ README.md
The SmartVehEntryAI system utilizes an SQLite database (easily adaptable to PostgreSQL) to manage vehicle logs and banned vehicle records. Below is a detailed breakdown of the tables and their respective fields:
This table stores comprehensive records of all vehicle entries and exits, including detection details and operational metadata.
| Column Name | Data Type | Constraints | Description |
|---|---|---|---|
id |
Integer |
PRIMARY KEY, INDEX |
Unique identifier for each vehicle log entry. |
vehicle_number |
String(20) |
INDEX, NOT NULL |
The detected and validated license plate number. |
driver_name |
String(100) |
NULLABLE |
Name of the vehicle's driver. |
vehicle_type |
String(50) |
NULLABLE |
Type of vehicle (e.g., Car, Truck, Motorcycle). |
entry_time |
DateTime |
NOT NULL, DEFAULT=datetime.now, INDEX |
Timestamp when the vehicle entered or was first logged. |
exit_time |
DateTime |
NULLABLE, DEFAULT=None, INDEX |
Timestamp when the vehicle exited, if applicable. |
status |
String(10) |
DEFAULT="ENTRY" |
Current status of the vehicle log (ENTRY or implicitly EXIT if exit_time is set). |
operator_id |
String(50) |
DEFAULT="system" |
Identifier for the operator who logged the entry (or "system"). |
image_path |
Text |
NULLABLE |
Path to the image file associated with the log entry. |
gate_id |
String(50) |
DEFAULT="main_gate" |
Identifier for the gate where the entry/exit occurred. |
remarks |
Text |
DEFAULT="" |
Any additional remarks or notes for the entry. |
Indexes:
idx_entry_timeonentry_timeidx_exit_timeonexit_timeidx_vehicle_exitonvehicle_number,exit_time
This table stores records of vehicles that are prohibited from entering the facility.
| Column Name | Data Type | Constraints | Description |
|---|---|---|---|
id |
Integer |
PRIMARY KEY, INDEX |
Unique identifier for each banned vehicle record. |
vehicle_number |
String(20) |
INDEX, NOT NULL, UNIQUE |
The license plate number of the banned vehicle. |
reason |
Text |
NULLABLE |
Reason for banning the vehicle. |
banned_at |
DateTime |
NOT NULL, DEFAULT=datetime.now |
Timestamp when the vehicle was added to the banned list. |
banned_by |
String(50) |
DEFAULT="admin" |
User or system responsible for banning the vehicle. |
git clone https://github.com/shailesh22290/SmartVehEntryAI.git
cd SmartVehEntryAI
conda create -n veh_ai python=3.10
conda activate veh_ai
pip install --upgrade pip
pip install -r requirements.txtRequirements: Python β₯3.10, CUDA-enabled PyTorch for GPU (optional but recommended).
# Double-click or run from terminal:
start.batchmod +x start.sh
./start.sh
# http://0.0.0.0:8000/ for Input
# http://0.0.0.0:8000/admin/login for ManagementAdmin Panel | Username: admin
Password: admin123
To retrain the YOLOv8 model on your custom dataset, run the following command:
yolo task=detect mode=train model=yolov8n.pt data=dataset.yaml epochs=50 imgsz=640dataset.yaml:
train: dataset/train/images
val: dataset/val/images
nc: 1
names: ["number_plate"]- Snapshot of the frontend showing the Model ouptut and a form to save the details in the database. This inteface will be used by the staff at the main gate.
- Snapshot of the Admin Panel showing the interface that will be displayed to the Admin for monitering and managing the entry/exit process.
- FastAPI β Modern, high-performance web framework.
- SQLAlchemy β ORM for database interaction.
- Uvicorn β Lightning-fast ASGI server.
- YOLOv8 β State-of-the-art license plate detection.
- PaddleOCR β High-accuracy OCR engine.
- OpenCV β Real-time computer vision and image processing.
- Python
reModule - For number plate cleaning and regex validation.
- Tailwind CSS β Utility-first CSS framework for rapid UI development.
- Chart.js β Simple yet flexible data visualization.
- Material Icons β Clean and modern icons.
- Vanilla JavaScript β Lightweight and efficient, with no framework overhead.
- SQLite (Default) β Easy setup, ideal for development and small-scale deployment.
- PostgreSQL (Production Ready) β Easily adaptable for a scalable and robust database.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new feature branch (
git checkout -b feature/amazing-feature). - Commit your changes (
git commit -m 'Add amazing feature'). - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.
This project is released under the MIT License.
For commercial use or enterprise deployment, please contact the maintainers.
- YOLOv8 by Ultralytics
- PaddleOCR by PaddlePaddle
- The FastAPI framework and its community
- Tailwind CSS
- Chart.js
For issues, questions, or contributions, please use the following channels:
- π Bugs & Issues: Open an issue
- π‘ Feature Requests: Start a discussion
- π§ Contact: [email protected] / [email protected]






