Skip to content

This project utilizes YOLOv8 for real-time car plate detection and OCR (Optical Character Recognition) to extract plate numbers from detected regions. The system leverages advanced computer vision techniques to streamline the recognition process and provide precise results.

Notifications You must be signed in to change notification settings

Ayeshaaaaaaaaa/Car-Plate-Detection-and-OCR-Recognition-with-YOLOv8

Repository files navigation

Car-Plate-Detection-and-OCR-Recognition-with-YOLOv8

This project utilizes YOLOv8 for real-time car plate detection and OCR (Optical Character Recognition) to extract plate numbers from detected regions. The system leverages advanced computer vision techniques to streamline the recognition process and provide precise results.

Fine-Tuning YOLOv8 for License Plate Detection

In this project, I fine-tuned the YOLOv8 model to specialize in detecting license plates using a custom dataset. Starting with the pre-trained YOLOv8 model (yolov8n.pt), I adapted it to my specific use case of license plate detection by training it on a labeled dataset of license plates.

Training Details:

Epochs: 100
Image Size: 640x640 pixels
Batch Size: 16
Learning Rate: Initial learning rate of 0.01 with gradual decay
Momentum: 0.937
Weight Decay: 0.0005
Warmup Epochs: 3
Data Augmentation: Enabled
Rectangular Training: Used to maintain aspect ratio
image

Evaluation Metrics:

Mean Precision: 0.8748 - Indicates the proportion of true positive detections among all detections.
Mean Recall: 0.8333 - Reflects the model's ability to identify all relevant license plates in the dataset.
[email protected]: 0.8429 - Mean Average Precision at an IoU threshold of 0.5, showing strong object localization performance.
[email protected]:0.95: 0.6182 - Measures model performance across multiple IoU thresholds, demonstrating robustness.
Approximate Accuracy: 0.8535 - A combined measure of precision and recall, providing a comprehensive view of model accuracy.

Loading YOLOv8 and EasyOCR Models:

The YOLOv8 model is loaded for detecting car plates, and the EasyOCR library is initialized to read text from detected plates.
The YOLO('best.pt') command loads the pre-trained YOLOv8 model from the specified file. The Reader(['en']) initializes the EasyOCR model to recognize English text.
image

Handling Image Upload and Processing:

When a user uploads an image, it is resized to 640x640 (the required size for YOLO), and plate detection is performed.

image

License Plate Detection and OCR Processing:

Once YOLO detects bounding boxes (plates), the cropped region is processed using OCR.

image

Image Processing for Better OCR:

The process_and_ocr function enhances the OCR accuracy by converting the cropped image to grayscale, resizing it, applying Gaussian blur, and using adaptive thresholding to binarize the image.

image

Displaying Results:

Bounding boxes and detected plate numbers are drawn on the original image for visualization.

image

Returning the Results:

The extracted plate numbers and paths to saved images (with bounding boxes and processed plates) are returned as a JSON response.

image
image

Contribution and Collaboration

I warmly welcome contributions and collaboration on this project! Whether you have suggestions for improvements, new features, or bug fixes, your input is highly valued. To contribute, please follow these steps:

Fork the Repository: Create a personal copy of the repository to work on.
Create a Branch: Develop your changes on a separate branch to keep the main branch stable.
Make Changes: Implement your enhancements or fixes and test them thoroughly.
Submit a Pull Request: Once you’re satisfied with your changes, submit a pull request for review.

About

This project utilizes YOLOv8 for real-time car plate detection and OCR (Optical Character Recognition) to extract plate numbers from detected regions. The system leverages advanced computer vision techniques to streamline the recognition process and provide precise results.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published