This project is a complete solution for detecting and managing license plates of Indian vehicles. It uses a fine-tuned YOLOv11 model to identify license plates in images, validate their format, and store them in a CSV file. The system is designed to be intuitive and scalable, with a FastAPI backend for seamless integration and deployment.
The fine-tuned YOLOv11 model offers high accuracy in detecting license plates, even in complex scenarios like low light or partially obscured views.
Built-in validation logic ensures the detected license plates match the standard Indian vehicle registration format, preventing incorrect entries.
All valid license plates are stored in a CSV file (detected_plates.csv
), making it easy to track and analyze results.
A RESTful API allows users to upload images and receive detection results instantly. This API can be easily integrated with other applications or systems.
Make sure you have the following installed before running the project:
- Python 3.8+: Required for compatibility with the dependencies.
- FastAPI: Backend framework for creating APIs.
- YOLOv11 Model Weights: Pre-trained weights specific to license plate detection.
- OpenCV: For image manipulation and preprocessing.
- PyTorch: The deep learning library used by YOLOv11.
- Uvicorn: An ASGI server to run the FastAPI app.
-
Clone this repository:
git clone https://github.com/vishnuvskvkl/Automatic-License-Plate-Detection.git cd automatic-license-plate-detection
-
Install the required dependencies:
pip install -r requirements.txt
-
Place the YOLOv11 model weights in the
models/
directory (create this directory if it doesn’t exist).
-
Start the FastAPI server:
uvicorn main.app:app --reload
-
Open the API documentation in your browser at http://127.0.0.1:8000/docs.
- GET /health
- Description: Check the health of the API.
- Response:
{"status": "healthy"}
- GET /process_image
- Description: Process an image using PaddleOCR for license plate detection.
- Input: Upload an image.
- Response:
{ "status": "image processing completed" }
- POST /process_video
- Description: Upload a video for license plate detection (processed in the background).
- Response:
{ "status": "video processing initiated" }
- GET /get_results
- Description: Retrieve all detected license plates.
- Response: List of all detected license plates in JSON format.
- GET /filter_results
- Description: Filter license plates by date range and/or plate number.
- Parameters:
start_date
(optional): Start date for filtering.end_date
(optional): End date for filtering.plate_number
(optional): License plate number to filter by.
- Response: Filtered results in JSON format.
- GET /search_plate
- Description: Search for a specific license plate number.
- Parameter:
plate_number
(required). - Response: Details of the searched license plate.
Below is an example of a license plate and its corresponding Detection:
demo.mp4
.
├── app
│ ├── data # Data-related operations
│ ├── routes # API routes for detection
│ │ ├── __init__.py
│ │ └── detection_route.py
│ ├── utils # Utility functions and configurations
│ │ ├── __init__.py
│ │ ├── handler_data.py # Data processing utilities
│ │ ├── handler_detection.py # Detection logic
│ │ ├── log_config.py # Logging configuration
│ │ └── config.py # Configuration settings
│ └── main.py # FastAPI application entry point
├── sample_data # Directory containing sample images
├── Dockerfile # Docker container setup
├── LICENSE # License information
├── pyproject.toml # Project metadata and dependencies
├── requirements.txt # Python dependencies
└── README.md # Project documentation
- Database Integration: Migrate CSV storage to a scalable database for larger applications.
- Cloud Deployment: Deploy on cloud platforms like AWS or Azure for improved scalability.
This project is licensed under the MIT License. See the LICENSE file for details.