ap-apely/PlateVision

Alex Karpov

PlateVision ๐Ÿš—โœจ

A computer vision system designed to detect license plates and recognize text within them.

Table of Contents ๐Ÿ“š

About ๐Ÿ”

PlateVision ๐Ÿš—โœจ is an advanced computer vision system designed to detect license plates and recognize the alphanumeric text within them. The system utilizes state-of-the-art deep learning techniques, specifically the YOLOv11 model for object detection ๐Ÿง  and a Convolutional Recurrent Neural Network (CRNN) for optical character recognition (OCR) ๐Ÿ“œ. PlateVision is built to be efficient, flexible, and highly accurate in real-world applications, such as vehicle surveillance ๐Ÿš“, toll collection ๐Ÿ’ธ, and automated parking systems ๐Ÿ…ฟ๏ธ.
The system is composed of two core components:
License Plate Detector ๐Ÿš™๐Ÿ”: The detection module uses YOLOv11, a cutting-edge object detection model, to identify license plates in an image or video frame ๐ŸŽฅ. YOLOv11 is a fast and accurate deep learning model capable of detecting multiple objects in real-time โฑ๏ธ. It is well-suited for high-speed applications like vehicle monitoring. This model processes images to predict bounding boxes around license plates, enabling the system to focus on relevant areas for text recognition.
License Plate Text Recognition ๐Ÿ“๐Ÿ” : After detecting the license plate, the system uses a CRNN model to recognize the alphanumeric text within the plate ๐Ÿ…พ๏ธ๐Ÿ”ก. A CRNN combines the power of Convolutional Neural Networks (CNNs) for feature extraction ๐Ÿ” and Recurrent Neural Networks (RNNs) for sequence modeling ๐Ÿ”. This makes it highly effective for text recognition tasks, especially when the text is skewed, noisy, or in non-standard fonts. The CRNN model converts the extracted features from the license plate into readable text.

Use Cases ๐ŸŒ:

Vehicle Identification ๐Ÿš™๐Ÿ”‘: Automating vehicle registration and identification in smart city applications ๐Ÿ™๏ธ, including toll booths ๐Ÿš, automated parking ๐Ÿ…ฟ๏ธ, and security systems ๐Ÿ›ก๏ธ.
Law Enforcement ๐Ÿ‘ฎโ€โ™‚๏ธ: Assisting in tracking vehicles of interest ๐Ÿš” or enforcing traffic laws ๐Ÿ›ฃ๏ธ by capturing license plate data in surveillance footage ๐ŸŽฅ.
Fleet Management ๐Ÿš›: Automatically tracking and recording the location of fleet vehicles for logistics companies ๐Ÿšš๐Ÿ’จ.
PlateVision is built for ease of use, ensuring that both researchers ๐Ÿง‘โ€๐Ÿ”ฌ and developers ๐Ÿ‘จโ€๐Ÿ’ป can quickly integrate license plate detection and text recognition into their own projects. With a strong focus on performance โšก and accuracy ๐ŸŽฏ, it is an ideal solution for applications where automated license plate reading is essential.

Features ๐ŸŒŸ:

High Accuracy ๐ŸŽฏ: The combination of YOLOv11 and CRNN ensures reliable and precise detection and recognition of license plates, even in challenging conditions such as varying lighting ๐ŸŒ…, angles โ†—๏ธ, or occlusions ๐Ÿ›‘.
Real-Time Processing โšก: The system is designed to work efficiently for real-time applications, providing fast and scalable performance ๐Ÿ–ฅ๏ธ.
Flexible Input ๐ŸŽจ: Supports both grayscale and color images ๐ŸŒˆ with a variety of resolutions ๐Ÿ“ธ, making it adaptable to various sources like CCTV footage or static images.
Scalability ๐Ÿ“ˆ: Easily adaptable for large-scale systems, such as traffic monitoring ๐Ÿšฆ or fleet management ๐Ÿšš, with the ability to handle batch image processing.

Requirements ๐Ÿ› ๏ธ

To run the project, make sure you have the following:
Python 3.8 or higher
PyTorch 1.9 or higher
OpenCV 4.5 or higher
Ultralytics (YOLOv11 model)
Albumentations (image augmentation library)

Installation โš™๏ธ

Follow these steps to set up the project:
Clone the repository:
Install the required libraries:
If you encounter any issues, make sure to update your Python version and dependencies.

Usage ๐ŸŽฌ

License Plate Detection and Text Recognition

Run the main script to detect license plates and recognize text in an image:
python main.py /path/to/image.jpg

Config โš™๏ธ

The configuration file allows you to easily adjust the settings for the project. Below is an example of a typical configuration:
basic: use_cuda: true yolo_model: ./license_plates_box/weights/license_plates_detection.pt text_model: ./license_plates_text/weights/license_plates_text.pth additional: image_resolution_x: 1920 image_resolution_y: 1080 text_recognition: defaults: - override hydra/job_logging: custom processing: device: cuda image_width: 180 image_height: 50 training: lr: 3e-4 batch_size: 8 num_workers: 4 num_epochs: 10 bools: DISPLAY_ONLY_WRONG_PREDICTIONS: true VIEW_INFERENCE_WHILE_TRAINING: true SAVE_CHECKPOINTS: false paths: dataset_dir: ./dataset/train/img save_model_as: ./logs/2.pth model: use_attention: true use_ctc: true gray_scale: true dims: 256

Explanation ๐Ÿ“:

basic: Contains general settings such as whether to use CUDA for GPU acceleration โšก and paths to the YOLO ๐Ÿš— and CRNN ๐Ÿง  models.
additional: Defines the image resolution for input images ๐Ÿ“ธ.
text_recognition: Contains configuration related to text recognition ๐Ÿ“, including processing settings (e.g., device, image size), training parameters (e.g., learning rate, batch size), and paths for dataset ๐Ÿ“‚ and model saving ๐Ÿ’พ.
model: Contains model-specific settings like whether to use attention mechanisms ๐Ÿ‘€ or grayscale input ๐Ÿ–ค.
You can adjust these settings based on your system's specifications ๐Ÿ–ฅ๏ธ and the specific needs of your project ๐Ÿ› ๏ธ.

Training ๐Ÿ‹๏ธโ€โ™‚๏ธ

Text Recognition Model ๐Ÿ“œ

How to Train ๐Ÿ“:

Prepare the Dataset: Create a directory called "dataset" and place your images in it (preferably PNG, but other formats are acceptable as long as you modify the code to handle them). The name of each image must correspond to the text written in the image.
Directory Structure: Your file tree should look like this: PlateVision โ””โ”€license_plates_text โ””โ”€Dataset ***.png
Image Names: The name of each image should represent the text it contains. For example, car.png should have the word "car" written on it, cat.png should have "cat", and so on.
Data Preparation: Ensure that all your images are of the same length. Padding is done automatically when using Attention + CrossEntropy. However, if you're using CTC Loss, padding is not automatically applied, so make sure to normalize your target lengths. You can add a special character to represent empty space, but avoid using the same character as the blank token in CTC (they are different). For example, 'car_.png', 'tree.png'

YOLO Visual Model ๐Ÿš—

How to Train YOLO Model ๐Ÿ“ธ:

Prepare Your Dataset:
Training:
Run Training: Hereโ€™s an example of how you can train the YOLO model using the train.py script:
Model Export: After training, you can export the model to the desired format (e.g., ONNX or TorchScript) for deployment. The exported model can then be used for inference in your vehicle detection system.

Additional information about the future of this project...

(P.S I may upgrade this repo in the future by adding my own pre-trained weights and creating a real-time web-based interface. Star the project to support me!)
Like this project

Posted Nov 22, 2024

PlateVision ๐Ÿš—โœจ is an advanced computer vision system designed to detect license plates and recognize the alphanumeric text within them. The system utilizes sta

Likes

0

Views

0

MoodLens: Sentiment Analysis Dashboard
MoodLens: Sentiment Analysis Dashboard
LlamaDigest: Text Summarization API
LlamaDigest: Text Summarization API

Join 50k+ companies and 1M+ independents

Contra Logo

ยฉ 2025 Contra.Work Inc