Skip to content

EmrNITK/ANPR-ML

Repository files navigation


ANPR System

Automatic Number Plate Recognition (ANPR) is a computer vision technology that enables automatic detection, reading, and recognition of license plate numbers on vehicles.

Table of Contents
  1. About The Project
  2. Getting Started
  3. Approach
  4. Datasets
  5. Results
  6. Contributing

About The Project

An Automatic Number Plate Recognition (ANPR) system is a computer vision technology to read and recognize license plate numbers on vehicles. ANPR systems are commonly used for security and surveillance purposes, such as identifying stolen or wanted vehicles, monitoring traffic flow, and enforcing parking regulations.

Implementing an ANPR system involves several steps, including image acquisition, preprocessing, segmentation and character recognition. The system captures an image of the vehicle's license plate using a camera, applies various image processing techniques to enhance the image quality and extract the license plate region, segments the individual characters on the plate, recognizes the characters.

(back to top)

Getting Started

For testing the ANPR system on sample images, run main.py file.

python main.py

Installation

To install these tools, follow the instructions below:

Python:

Download and install the latest version of Python from the official website: https://www.python.org/downloads/

OpenCV:

Install OpenCV using the following command in your terminal or command prompt:

pip install opencv-python 

YOLOv7:

Clone the YOLOv7 repository from GitHub: https://github.com/WongKinYiu/yolov7.git

Torch:

Install PyTorch using the following command:

pip install torch 

Numpy:

Install Numpy using the following command:

pip install numpy 

Tensorflow:

Install Tensorflow using the following command:

pip install tensorflow 

Scikit-learn:

Install Scikit-learn using the following command:

pip install scikit-learn 

(back to top)

Approach

Our algorithm works as follows:

  1. The license plate is detected from the input image. It has been done using an object detection method: You-Only-Look-Once(YOLOv7).
  2. Once we get the number plate region, Deskewing is done for correcting the rotated number plates.
  3. Character segmentation is done to extract the characters from the number plate using adaptive thresholding and contour manipulation.
  4. At last step, segmented characters are recognized using CNN.

Datasets

The following datasets have been used in this ANPR system:

For License plate detection (YOLOv7):

This dataset contains 453 files - images in JPEG format with bounding box annotations of the car license plates within the image. Annotations are provided in the PASCAL VOC format. Pascal VOC(Visual Object Classes) is a format to store annotations for localizer or Object Detection datasets and is used by different annotation editors and tools to annotate, modify and train Machine Learning models. The dataset can be found and downloaded from here https://www.kaggle.com/datasets/aslanahmedov/number-plate-detection You can download the trained model from here: https://drive.google.com/file/d/1f7tWbDNqfWqca1gy91ItV5gkwUOpLAHx/view?usp=sharing

For Character recognition:

The dataset has about 2000 images of digits from 0-9 and alphabets from A-Z. You can download the dataset from here: https://drive.google.com/file/d/1y8OG1GwfTd7fZMpu7rFsSVEa3wj1I98q/view?usp=sharing You can download the trained model from here: https://drive.google.com/file/d/14op_-psIamfE0dopkSNpL7jAc4Meu-9H/view?usp=sharing

For testing the whole anpr system:

The dataset contains about 166 images of cars with license plates. You can find the dataset here: https://drive.google.com/file/d/1r_X_Wf4FQ8AcgOvy6o2AdBk11LJB67D_/view?usp=sharing

Results

License plate detection using YOLOv7 works perfectly on most images. It fails in some cases when a vehicle contains text similar to number plate.

The accuracy of CNN used for character recognition is about 98%.

The overall accuracy of the ANPR system proposed here is 86.75%, which is tested on test_dataset mentioned in dataset section.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published