License Plate detection and recognition on Indian Number Plates using Yolo v3 Darknet and Pytesseract
- Download the starter dataset in JSON format from https://www.kaggle.com/dataturks/vehicle-number-plate-detection
This would serve as our starter dataset
-
Check out JSON preprocessing to yield the dataset in yolo format here
-
I have uploaded the prepared dataset too
git clone https://github.com/pjreddie/darknet
cd darknet
-
We add our processed data to the data folder in the darknet directory
-
After cloning the darknet repository, we run split.py to segregate the data into training and validation image paths https://github.com/sid0312/ANPR/blob/master/split.py in darknet/data/train.txt and darknet/data/val.txt repectively
The entire training process has been explained here
We train on YOLO v3 Darknet in Google Colaboratory. Notice the darknet forlder in the repository shows the files to be added to the cloned repository from Pjreddie.
Model checkpoints
git clone https://github.com/sid0312/ANPR
cd ANPR
python test.py -i /path/to/image -c /path/to/config_file -w /path/to/weights/ -cl /path/to/obj.names
Note: It works on only high resolution images as the dataset contains only 237 images. A larger manually labelled dataset would lead much robust predictions
Now we use Optical Character Recognition on the cropped Region of Interest to obtain the value of the license plate. We use the awesome Pytesseract library
cd ANPR
python recognition.py /path/to/cropped/img