This project using yolov3 to detection car license plate
Python 3.8 or later with the following pip3 install -U -r requirements.txt packages:
Numpy == 1.21.2
Opencv-python == 4.5.3.56
I downloaded my car license plate dataset which contains 433 .png and .xml files, from Kaggle. It can be found and download from here
https://www.kaggle.com/andrewmvd/car-plate-detection#
I augmented dataset and my dataset turned into 690 images. You can augment your dataset here
-
upload our dataset on google drive
-
mount the Google Drive to Google Colab
from google.colab import drive
drive.mount('/content/drive')
- clone the darknet git repository
! git clone https://github.com/AlexeyAB/darknet
- Open darknet/Makefile and put 1 in front of GPU, CUDNN, and OPENCV instead of 0. These changes are required if you wanted to use GPU on Google Colab.
%cd /content/darknet
!sed -i 's/OPENCV=0/OPENCV=1/' Makefile
!sed -i 's/GPU=0/GPU=1/' Makefile
!sed -i 's/CUDNN=0/CUDNN=1/' Makefile
- Install the base darknet framework with the below commands.
%cd darknet
! make
- Make a copy of yolov3.cfg
!cp cfg/yolov3.cfg cfg/yolov3_training.cfg
- Change lines on yolov3.cfg file
!sed -i 's/batch=1/batch=64/' cfg/yolov3_training.cfg
!sed -i 's/subdivisions=1/subdivisions=16/' cfg/yolov3_training.cfg
!sed -i 's/max_batches = 500200/max_batches = 6000/' cfg/yolov3_training.cfg
!sed -i '610 s@classes=80@classes=2@' cfg/yolov3_training.cfg
!sed -i '696 s@classes=80@classes=2@' cfg/yolov3_training.cfg
!sed -i '783 s@classes=80@classes=2@' cfg/yolov3_training.cfg
!sed -i '603 s@filters=255@filters=21@' cfg/yolov3_training.cfg
!sed -i '689 s@filters=255@filters=21@' cfg/yolov3_training.cfg
!sed -i '776 s@filters=255@filters=21@' cfg/yolov3_training.cfg
-
Create .names and .data file
-
Upload dataset in Colab
-
Download pre-trained weights for the convolutional layers file
!wget https://pjreddie.com/media/files/darknet53.conv.74
- start training
!./darknet detector train data/obj.data cfg/yolov3_training.cfg darknet53.conv.74 -dont_show
I couldn’t push my final weights file (yolov3_training_final.weights 234MB)
you can download it from here
https://drive.google.com/file/d/1W8x_S_9-bk9sZuGtzUnE6FZGqeV9v-tl/view?usp=sharing
Download my LP-detection repository and .weights file Test on a single image:
Python yolo.py --image test.jpg