- yolov4 : I used this OD model because it performs much better than traditional computer vision methods.
- Easy OCR : In this project I used EasyOCR to extract text and leverage a size filtering algorithm to grab the largest detection region. EasyOCR is build on PyTorch.
- openCV: It is a library mainly used at real-time computer vision.
- Tensorflow : Here I used Tensorflow object detection Model (SSD MobileNet V2 FPNLite 320x320) to detect the plate trained on a Kaggle Dataset.
- Python Libraries: Most of the libraries are mentioned in requirements.txt but some of the libraries and requirements depends on the user's machines, whether its installed or not and also the libraries for Tensorflow Object Detection (TFOD) consistently change. Eg: pycocotools, pytorch with CUDA acceleration (with or without GPU), microsoft visual c++ 19.0 etc.
These outline the steps I used to go through in order to get up and running with ANPR.
Step 1. Clone this repository: https://github.com/harshitkd/Real-Time-Number-Plate-Recognition
Step 2. Create a new virtual environment
python -m venv arpysns
Step 3. Activate your virtual environment
source tfod/bin/activate # Linux .\arpysns\Scripts\activate # Windows
Step 4. Install dependencies and add virtual environment to the Python Kernel
python -m pip install --upgrade pip pip install ipykernel python -m ipykernel install --user --name=anprsys
Used the Car License Plate Detection kaggel dataset and manually divided the collected images into two folders train and test so that all the images and annotations will be split among these two folders.
I used pre-trained state-of-the-art model and just fine tuned it on our particular specific use case.Begin the training process by opening Real Time Number Plate Detection and installed the Tensoflow Object Detection (TFOD)
In the below image you will see the object detection model which is now trained. I have decided to train it on the terminal because the training inside a separate terminal on a windows machine displays live loss metrics.
- Visualization of Loss Metric, learning rate and number of steps:
tensorboard --logdir=.
import easyocr detection_threshold=0.7 image = image_np_with_detections scores = list(filter(lambda x: x> detection_threshold, detections['detection_scores'])) boxes = detections['detection_boxes'][:len(scores)] classes = detections['detection_classes'][:len(scores)]
Used this in real time to detect the license plate and stored the text in .csv file and images in the Detection_Images folder.
tensorboard --logdir=.