Automatic License Plate Recognition using YOLOV8 and EasyOCR ( Images & Videos)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys in this video we will see how we can Implement license plate detection and recognition using your low V8 so for the implementation I will be using Google collab notebook so let's start the implementation so if you follow the steps uh provided in the studio tutorial at the end of the video you will be able to get this like demo like this or output like this so this is the GitHub repository which I will be using in this project so the steps to run the code are given here the all the steps are provided one by one and this is the output results which I have added over here so first of all you just need to go here and just clone this GitHub repo okay so this is the collab notebook file uh which I am which in which all that implementation is provided step by step so this notebook file will only be available to our patreon supporters so so if you're not a veteransporter so if you become a pet transporter you will have access to all the explosive projects which I have shared here we really should different projects we have shared like we have shared file detection using yellow V8 here real-time segmentation and tracking using yellow V8 installer V7 is 10 segmentation with distance estimation and road sign and traffic light detection and color recognition so if you become a pet transporter by just contributing five dollars a month you will have access to all these exclusive projects plus we also provide support in the case if you are facing an issue to run the code on your side or if you have any questions regarding the code we also help you so just need to go here and just paste the wrapper which we have turned over here so first of all I have already run the script so let me display it and delete this from time and start with a new runtime it's just connecting here and just I will go to the runtime and select the runtime as GPU so okay so now I will run this cell and now I will clone this GitHub wrap over here so you can see that now we have that up over here now just selecting the current directory as this repo now we'll all require install all the dependencies basically if you install uh don't install the dependencies we don't have the all the required libraries installed so if you install all the dependencies uh using pip install minus edif we have all the required libraries installed so we don't face an issue like matplotlib is not installed numpy is not respond installed or hide by libraries not installed so by installing the by writing pip install minus E will install all the required dependencies and we have all the required libraries so if we check this file as well so you can see that this is the file we have so so as we are performing object detection over here basically like we are detecting the lessons plate and then reading the text uh in the lessons plate so let me show you so we will go to the direction folder and just go over here and copy the path and just write it over here so now we will download the data set from roboflow so here I've just added the link you can just go over here just you can just go to roboflow and download this data set from the robot flow I will add the data set link in the description of the video so the data set will be down is downloading so it might take one to two minutes to download so let's wait till then until it downloads completely so a data set is downloaded now we need to train our custom model for lessons play detection so let's train the model so now our training is done so these are all the files which we have in the training folder you can see and this is the confusion Matrix which I have and so let's first look at the confusion Matrix and see what does the confusion Matrix tells us so confusion Matrix is the chart that shows us how our model handle different classes but here we have a single class so let's see the results so for 84 percent of times our model successfully detects that there is a license plate while 16 of the times our model fails to detect anything like there is a model does not detect anything so 84 percent of the times our model successfully detect that there is a sense plate while 16 of the times our model fails to detect anything like there is a simple background nothing is detected and there are the 20 losses and validation losses so here uh the most important losses we are concerned is box loss and CLS laws so you can see that loss is decreasing as the number of epochs increasing and the mean average Precision or recall score is increasing by the num as the epochs increase so if you you know currently we have trained our model on 120 box so if you train the model on 200 250 bucks definitely you will get some better results so these are the results on the validation badge so these are the basically these are the images or desserts of model protection on the validation badge so these mod images are not used for training so it is always better to take a look and see how our models performs on the validation badge okay so I have saved the model where it's on the Google Drive so I'm just downloading the weights from the Google Drive so it's better to save your weights on the drive and now I will validate the custom model so here I have validating the custom model and for I am getting a good mean average Precision of 0.0.926 with IOU of 50. so if my IOU moves from 50 to 95 I get the mean average Precision of 0.582 so basically uh after detecting the lessons plates now to read the text uh so basically let me show you let me leave first lessons there let me show you the simple implementation the so here we are just downloading a demo video for texting our model from the Google Drive and list run it So currently our only detect interesting in detecting the license plate after this we will update the predict.5 file to read the text of the lessons played like read the license plate number my end aim is to read the lessons plate number so let's move it towards it so it might take few minutes so let's just wait till then and as it computes then we will move ahead sure okay just copy this over here and here write demo dot MP4 and just spawn this so we are just testing on a single demo video so just skip this so it might take a few minutes so until the demo video appears so in this video we are only detecting the license plate we are not reading the distance plate number uh which will move it uh this implement the next step so let's see what output do we get over here so it might take few minutes so let's wait until then okay so we are good so here are our results so you can see that we are detecting the sense plate so but we need to read the text of the lessons plate like I need to read the lesson plate number to read that lesson plate number I will make few adjustments into my code so I will open the predict.pi file so using easy OCR I will be reading the license plate number so first of all here just write Imports CV to import is the OCR just right reader is equal to e z o c r dot feeder yeah I will create an image basically a en means we are reading the English and GPU means we have GPU enabled in our system so we'll write Define OCR image image coordinates so we write x y U and coordinates 0 coordinates one just copy this and there is this so here we are just basically uh cropping the image or and we are just focusing on the part where we have the lessons play detected so we are cropping the image and where we have the lessons they detected we are just focusing on that part and then we will read the text of the lessons played so now we will convert the license plate into grayscale because we have cropped the image and we have only uh now we have only the image where we have the lessons played so now we are converting uh the lessons played into a grayscale image from RGB now I will downright now we need to after converting to grayscale now we need to read the text uh so we will write result is equal to so using ecocr now we will read the text from the number plate so I have initial ID in easy or CR over here so I'll write reader Dot delete text and we need to read the text from the grayscale image of the nump lessons plate so we are have written gray over here and let's read the text over here and foreign [Music] so if land result is equal to [Music] okay is equal to one text is equal to yes [Music] with some is greater than one and length was solved one is greater than six and there's two and zero one two that is important so that's good so we have uh return let's just see if we have made any mistake um so we have to find the confidence everything over here so let's just go below and right once so if we have don't have anything over here it's okay so now we'll go below and just update one here which is over here Time Zero X Y X Y text OCR so let's run this script and see what results we get if you have any error we will definitely fix it but I believe that it is correct oh no Miss I think it's not deleted yet so now just run the script and see what output we get so okay pip install we have not installed OCR so just install ezocr first and then we run this script okay import CV2 dots okay I can make a spelling mistake let me correct it first and then I will move ahead so I think what I have made is one mistake my experience let me see what mistake I have made over here [Music] this should be capital okay let me see other things Okay Plus there should be RGB to grade two errors we have just fix them so now let's check it again hope it will now be fixed now let's run the script again one last time hopefully it will work fine now so running the script again so yes you know it might take few more minutes to run so let's play it until it runs so the script has been successfully now let's show this demo video over here and just make this change and now run this so let's see what results do we get over here so here is our output video and you can see that we are getting very impressive results and our model is able to detect the license plate as well as read the text using easy OCR in the sense plate as well so it's working very fine I will be sharing so the license plate reduction script will be provided uh as you know that this GitHub repo I will share the link of the GitHub wrapper in the description of the video but to get the lesson split recognition like reading text from the lessons plate so this file will be only provided to our Patron support so if you want to get the file you can be your patreon supporter or not then you can just review this video and just learn what made it what changes I made in the predict.pi file so you can get the same output like this thank you so much for watching see you in the next video bye
Info
Channel: Muhammad Moin
Views: 25,345
Rating: undefined out of 5
Keywords: yolov8, yolo, object detection, object segmentation, LicensePlateRecognition, ANPR, computervision, licenceplatedetection, numberplaterecognition
Id: lkAJBSmIL50
Channel Id: undefined
Length: 19min 26sec (1166 seconds)
Published: Sat Feb 04 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.