Automatic number plate recognition with Python, Yolov8 and EasyOCR | Computer vision tutorial
ฝัง
- เผยแพร่เมื่อ 7 มิ.ย. 2024
- Code: github.com/computervisioneng/...
🎬 Timestamps ⏱️
0:00 Intro
0:30 Start
1:44 Data
2:28 License plate format
5:00 License plate detection dataset
6:00 Code walkthrough
7:24 Main process
43:45 Get car id
51:34 License plate reader
59:57 Data cleaning and visualization
1:10:09 Outro
🌍 Community 👥
Join our Discord server: / discord
Support me on Patreon: / computervisionengineer
Hashtags #
#python #computervision #anpr #licenseplaterecognition #objectdetection #objecttracking #yolov8 #easyocr
Did you enjoy this video? Try my premium courses! 😃🙌😊
● End-To-End Computer Vision: Build and Deploy a Video Summarization API bit.ly/3tyQX0M
● Hands-On Computer Vision in the Cloud: Building an AWS-based Real Time Number Plate Recognition System bit.ly/3RXrE1Y
● Machine Learning Entrepreneur: How to start your entrepreneurial journey as a freelancer and content creator bit.ly/4bFLeaC
All my premium courses are available to the Computer Vision Experts in my Patreon. 😉
www.patreon.com/ComputerVisionEngineer
Thank you for this video! please how do I get the License_plate_detector.pt file?
@ComputerVisionEngineer Hey ! what is included in the course: Hands-on Computer Vision in the Cloud: Building an AWS-based Real Time Number Plate Recognition System, can we detect and extract license plate from video ? Will it work now? Is there any facility of help in case we face some problem. And how is that course different from this video
@@readbhagwatgeeta3810 Hey! The number plate recognition in the course is real time and based on Python and AWS, I recommend you to watch this other video first th-cam.com/video/hQgemv9Z3wg/w-d-xo.html. If you face any problem I am available for consultations, not sure if I will be able to solve your problem but I will try. 🙂
How come nothing works with opencv python anyway?
Just have to say wow.....finally, someone who can actually explain the whole process in a way non-datascientists can understand. Have also watched your video about creating custom dataset annotations - another excellent video. Thank you.
You are welcome! Glad you enjoyed it! 😃🙌
Hi I am facing an infinite loop ? How did you resolve it
Hola Felipe,
muchas gracias por tus videos! Me has ayudado muchísimo en mi primera entrada en el mundo de la detección de objetos.
Buen trabajo y muchos saludos!
Me alegro haber ayudado!! Saludos!! 😃🙌
Your videos are so clearly explained and helpful! Also I love your accent. I really would like to use this knowledge to build a live stream that saves the plates of the idiots that use the emergency lane...
I am working on something and this video was incredibly useful ! Thanks so much for that amazing content. You are the best.
Super man ) Thank you for your time and effort
Very nice! i maked a project like this about year ago, now i will watch your video for improves, tnx for sharing.
You are welcome! 😃🙌
You are a BEAST!! :) many thanks for your video mate :)
Thank you for your support! 😃🙌
That's a great video! Thank you very much
You are welcome! Glad you enjoyed it! 😃🙌
Nuevo suscriptor, arrancando en data science y computer vision. Admiro muchisimo tu nivel de ingles, felicitaciones y ojala algun dia hable como vos!
Saludos de Arg!!
Gracias por tu apoyo! 🙌
This is excellent work good sir. Keep being awesome.
Thank you! 😃🙌
Truly awesome explanation, sir
Thank you. 🙂 Glad you enjoyed it!
amazing tutorial. thanks for sharing it.
Great Video Felipe ! Muchisima gracias
You are welcome! 😃
you're doing great! thanks a lot 👌...
Thank you for your support! 😃🙌
Great content again!!! 🤩
Thank you! 😃💪
@@ComputerVisionEngineer hey why my comment is not getting posted I have a query please resolve
Hello Felipe! I was wondering if you could create a video showcasing real-time license plate recognition as well. It would be fantastic to see this in action, and I believe your expertise would make it an exceptional learning experience. Thank you for all the valuable content you provide!
As a matter of fact, I am currently preparing a video showcasing a real time license plate recognition system. I hope it will be ready soon. Stay tuned! 😃🙌
We are waiting sir.. Thanks alot
@@ComputerVisionEngineer
@@ComputerVisionEngineeraguardamos ancioso amigo por esse vídeo !!!
@@ComputerVisionEngineerwhen you will upload it ?
we are waiting sir@@ComputerVisionEngineer
Thanks for all these videos Felipe. Could you make a video about hyperparameters tuning for training the plate recognition model and improve the model performance?
Sure, I will try to do a video about hyperparameters tuning. 🙌
its great :)
Great video and explaination, I have a question regarding filtering out the number plate and retaining only the frame with the highest confidence level in my use case. I'm performing license plate detection and OCR without car detection. Will this approach be suitable for my use case?
Bravo Man
Super Work
Thank you! 😃💪
Hi, thank you for the content you create. i think you are the best out there on this topics. you said the pre-trained models are available on your patreon page what are the requirements to get it (i mean besides supporting this this great tutorials get published). or if there is any video of you showing how you trained the model on cocco dataset for example i would appreciate it. thank you.
The model is available to all Patreon supporters. Alternatively, if you want to train the model yourself, in this video I also show you what is the data I used to train the model, you can train the model following any of my tutorials on how to train an object detector using yolov8 on a custom dataset. 🙌
Can cars and license plates be annotated in the same image and assigned different classes, or are the datasets for the car and license plate detection models distinct? I have a similar project in mind, but I'm not sure the correct way to annotate images to first detect objects of a class, then detect objects of a different class within the detected object. Any advice is appreciated!
I have followed the code but instead of SORT used deepsort but I keep getting an error "non-iterable track object". I have printed the tracks and the values are present . It seems to be occuring at the point when I call get_vehicle. What could be the issue?
Hi!
@ComputerVisionEngineer. You mentioned at the beginning that it can be very challenging to detect plates as they have many shapes/backgrounds? Do you have any tips/articles/clues on how this could be done?
Keep it up!
Do you mean a number plate reader that works with any license plate type? Maybe training a custom ocr with lots of data of different license plate types it could work. 🙌
@@ComputerVisionEngineer Yes, thats what i meant. Thank you!
@@ComputerVisionEngineer One last question: applying the Sobel filter(gray scale) will allow us to detect any plate with ANY background? or do we need further pre processing in order to achieve this?
Thank you!
Excelente! Una consulta , el modelo preentrenado hay que volverlo a entrenar con el dataset? y si es asi hay que ver el otro video para entrenar el modelo? el codigo funciona pero no genera los csv porque no esta reconociendo las patentes. Saludos.
Gracias! Te referis al detector de patentes? Si usas el que entrene yo creo no tendrias que re entrenarlo. Aunque si no tenes un buen resultado con tus imagenes, podrias reentrenarlo.
Great tutorial
Is it possible to do this from a live stream or will the processing demands be too much? Ae you familiar with real-time license plate recognition from video streams?
You may be able to do it from a live stream and make it look ~real time by processing one every n frames. I am not familiar with real time license plate recognition software from video streams.
Hello, first of all, thank you for all the information and dedication you share on your excellent channel.
I want to ask you what you recommend to make an application for the detection and recognition of Car License Plates/License Plates/Patents (ANPR) of a WEB camera or a standard video surveillance camera for a development board of medium capacity but in real time such as to give access to cars at a door or barrier (night lighting may be adequate).
With the following options and know which one you recommend (if you have any other, welcome the suggestion)
- Development board: Raspberry Pi, Google Coral, ASUS Thinker Edge, Jetson Nano, etc.
- Programming Language: Python, C++, Java, .Net, Nod.js, etc.
- Libraries and/or Framework / tools: Yolo, OpenCV, OCR, preferably not Cloud
- To train the model that you would recommend, or if there is already one that can be purchased for my case
- I am in Mexico and the license plates would only be from the country
Where should i use the code should I use it on vs code ?
And if I should use vs code I tried to run it but I can't download the librarys what do you recommend?
Hello! Thanks for great tuturial. I wonder why you didn't use YOLO8 tracker?
hi sir i have to make a project on yolo v8 in my final m.phil thesis can you please guide me can we use yolo v8 for object detection on low light data ?
Hi bro
how can i download the trained model?
Cool
Is there a way to measure the speed of the car? In theory, I could imagine a solution to draw 2 lines and compute the distance/time with time = the subtraction between the time when the vehicle contacts line 1 and the time when the vehicle contacts line 2. However, this way only measures the speed at a determined area. It's kind of limited.
Yeah something like that would work. It would not be a perfect solution, but it would be a good estimate.
Hello,i love your video..... please can it also identify plate numbers from other countries or its just from what you used to train it
@ComputerVisionEngineer Hi thank for making this project and may I ask, which part that i've to make the adjustment if i wanna use webcam
You would need to do several changes in the visualization so it is done on 'real time', as the video is being processed.
Hi sir:
i really enjoyed by this tutorial and learned a lot of things and i followed this tutorial and write the notes down on the hard paper step by step so it was really valuable tutorial and the project is successfully run and work with me. But sir one question is come up in mind that when the main file is executed that creates test file, and in test file we will have a lot of car Ids that have been detected that obviously can not be seen in the normal sample video, so what and where these car Ids is come from?
thank you so much and looking forward the follow the other tutorials as well
Do you mean the object detector is detecting cars that are not in the video?
Great video and I was so close to joining the Patreon (first time ive ever been tempted) but £25 is just a little bit much :(
Thank you!! 😄 Oh, thank you so much for your feedback! Some of the posts are also available for the Computer Vision Enthusiasts tier. 😃🙌
then the enthusiast tier may be for me ! :)@@ComputerVisionEngineer
hello, just having one doubt instead of video can we take photos of license plate as our data for this video??
can i use input video from camera or cctv?
Hi, I am having challenges on how to create the content of the add_missing_data.py. Could you please explain to me once again
Hello Computer Vission Engineer , i just want to ask if there are something you recommend to replace openCV in my project?
Because im using IP cam as real time video and it cant support high resolution of the ip cam, it so lag and fps drop and crash after a mins.
But if i try to reduce resolution to 720p and 10 fps it work fine. I think openCV has a problem in high resolution IP cam.
And do you have also recommend for o.s?
Hello, OpenCV is usually a very efficient image processing library, it would be hard to find another library that works better in terms of performance, but you can try with Pillow and scikit-image. 🙌
hey, thank you very much for this tutorial . where can I get some videos like this one that you used om the highway for testing?
I got the video from pexels.
can i please know the specifications of the camera that you used in the video?
Thank you for this video! please how do I get the License_plate_detector.pt file?
I wonder as well. I think we have to make it ourselves using the technique of his other video "Train Yolov8 object detection on a custom dataset | Step by step guide | Computer vision tutorial"?
Hola Felipe, que buenos tutoriales los de tu canal, y gracias por compartirlos con nosotros los estudiantes 🙂.
Tengo una pregunta: donde puedo poner el "cv2.imshow('frame',frame)" para ver el video procesado en tiempo real...? Gracias...!!!
Para verlo en tiempo real son varios muchos cambios, tendrias que editar la visualizacion y 'enchufarla' al main file.
@@ComputerVisionEngineer estoy interesado igual en tener un ip camera como fuente de video y procesar el video en tiempo real, que necesito modificar?
Hello , in my code on colab, the line ' from sort.sort import Sort' get the error message "name 'Sort' is not defined ' , can you help to fix ? When i import util module,everythings ok.Tks
What assessment methods and assessment sets can I use for this model?
Excellent tutorial, when I am trying to understand more about this code, I wonder where could I find more detailed information about the coco_model. I tried to find it on the link you provide, syr I find nothing. Could you pls provide me like a link about the cocomodel?
Thank you! Sure, the 'coco model' is a model trained with the coco dataset. This is the official site of the coco dataset: cocodataset.org 🙌
Hello, I am interested in the license plate detector mentioned in the tutorial for automatic number plate recognition using Python, YOLOv8, and EasyOCR. Could you please guide me on where I might obtain this detector? Additionally, I'm curious if the detector is tailored to the license plates of a specific country and if there are instructions available on how to adjust it for recognition of plates from other countries. Thank you for your assistance.
Hi, the trained model is available in my Patreon. Regarding the object detection, it is likely to work in any other licence plate type, regarding reading the content you may need to adjust the code so it works with other types of license plates. 🙌
Hi sir , in parking spots video, Where did you get the dataset of images from?
No body know 😶
Can this be used to delect using live camera and nit a video??
please make a cctv that can detect an illegal parking using yolov8 love your videos bro much love from the Philippines ❤🙏
good idea bro, this topic will help me in my capstone project! 💜💜
What do you mean with 'illegal parking'?
@@ComputerVisionEngineer illegal parking detection of vehicle who's illegaly parked in the sidewalks, Appeciate ur comment bro,Thankyou so much ❤️🙏
@@seanjoloan9596 oh I see, ok, I will try do a video about it in the future 🙌
illegal parking violation is a common problem here in the Philippines surely people will love this to happen, thankyou brother ❤️
Sorry.. but where we can find the model folder and it's file... It's not in your given git repository... ?? Could you please tell me
Thanks for this tutorial!
I'm here because the training procedure of the EasyOCR detector does not seem to work very well, and I was wondering "what about Yolov8?".
(Might be personal preference, but I found the music of the introduction was very distracting.)
Thank you for your feedback! 🙌
I'm having difficulty recognizing the embossed text on the product, do you have any solution? Please reply me
hi felipe, if i change the video, would it able to detect it too?and what first i need to download if i want to do it from scratch? yolov8?easyocr?what else?
Please take a look at the project's repository, but it is based on Yolov8, EasyOCR and SORT if remember correctly. The license plate detection will work most likely, in order to read the number you will need to adjust some functions defined in util.py, format_license and license_complies_format. 🙌
Great, tutorial
Can you make a tutorial about drowsiness detection of drivers?
Thank you! Sure, I will try to do it. 💪
Hi Mate, I am using the same video stream and trying not to use the machine learning to achive the number plate identification for the last three months😂😂😂; Imaging how suprising I saw this video!
😂 That's quite a coincidence! 😃🙌
@@ComputerVisionEngineer Yeah, but anyway, it's an excellent video!!!!!!!!!!!!!!❤❤❤ Gives me so much inspiration!!!!!!!!!!!!!!!!!
where did you get that video?
getting following error ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running
This exactly i need for my Thesis, Im a computer engineering student.
😃 Cool! Glad the video is useful for your Thesis! 🙌
Hlo did u made the project by watching this video? If yes then pls can u help me get the highway video he used in project
Hey bro have you completed your thesis.
Hi, when i run the code at 9:16 ('/models/license_plate_detector.pt' it gives an error which is no directory found. May i know how to resolve this problem?
You need to create a directory called 'models' and you also need the 'license_plate_detector.pt' file. In order to download/produce the file take a look at the readme file of this project's repository. You can either train your own license plate detector by using the same data I used and following the same approach I followed, or you can just download the model from my Patreon here: www.patreon.com/posts/license-plate-87407533 🙌
Thanks for the explanation, I would be grateful if you could send me the link to the whole file (video, data, coco, model......)
Hello Felipe, i am trying to find the license plate detector on git and I can't find it. As you have said that it is on git but it is not on git
Hello, I moved the model, it is now available as an additional perk to my Patreons. Check it out here www.patreon.com/posts/license-plate-87407533 🙌
Hi Felipe, can you explain for me what "add_missing_data.py" file do?
Hey, for each license we will have missing values in those frames where we don't detect the license plate, or where the number plate we get doesn't comply with our format. So we compute those missing frames by interpolated the data from the closest available frames. 💪
Hello Mr. I want the Highway video , could you please share the highway video link !
how should i create the 'test.csv' file? Is it me that create it or the programme automatically create the 'test.csv'?
Hello Felipe, Is it possible to to the same thing but with yolo-nas? If so can you make a video on it please, I have been trying to work on this for 3 weeks and I am stuck on it so it would help a lot.
Yeah I think it would be possible to detect the license plates using yolo nas. I will try to do it.
can you provide complete github code (your end video full folder)
How do I use this model to recognize license plates on my real-time video captured in real life? Can you help me edit the Sort file properly!
Hey Felipe, I'm having trouble running this project on colab could you please post a video explaining how it can be done on colab
I will try to make a video explaining how to do it in a google colab. 🙌
Finally, found a channel I can learn this topic.
Can this work with raspiberry pi 4 with 8gb of ram!?
Also do you a tutorial I can learn for me to collect my custom data.
Thanks.
Subbed
I haven't tested it in a Raspberry pi, if you test it let me know how it goes!
I have a question, what if for example a car bounding box has 2 number plates, does this code work for it, or do we need to do some modification?
The code assumes each car bounding box has only one license plate, if there are two license plates you may need to do some modifications.
Can this code be used to recognize license plates of other countries??
How can I run this project on my laptop from your source code, there is csv missing
plz help me ....
I tried to run this code in my system with a pretrained-model yolo model for license plate recognition but I'm having these issues
1) the results are not being written in the csv file
2) when showing the frames that the model is extracting are oddly tiny
it would be helpful if someone can explain what is going on as I am confused regarding this
Hello Sir! I was wondering about how you trained the license plate detector model. Can you please tell, how many images you used to train the model, and on how many epochs?
I have trained the model using 1400 images, at 40 epochs. But I'm not sure if its giving me the best possible results.
Thank you so much for all the tutorials, they're awesome!
The dataset is linked in the github repository. Number of epochs was 20 if I remember correctly. 🙌
@@ComputerVisionEngineerThank you Sir
Hello do you have "license_plate_detector.pt" this file with you. If you have can you please share it with me because it not showing in github repository
thanks so much for this! i have a question. i am trying to replace vehicles = [2, 3, 5, 7] with vehicles = [0] to detect people but i am running into this error: ValueError: operands could not be broadcast together with shapes (0,) (1,2). any idea why?
Hey, in what part of the code you are getting this error?
@@ComputerVisionEngineer Traceback (most recent call last): File "main.py", line 39, in track_ids = mot_tracker.update(np.asarray(detections_)) (have emailed you, YT wouldn't let me post the whole error)
Hello, I traind the yolov8 (detect) on custom dataset now how can I assess the yolov8 model with test dataset where I can get Recall , Precision, mAP, confusion matrix, curvs, and accurecy.
from where to get that license_plate_detector.pt file ??can you plzzz guide me.......
From where do we get the model?
Hello, thank you for the video. i'm trying to use same algorithms with different video file but when no car detected i get an error. Please how could i handle that ?
Hey, good job. When i try run an app i have problem with sort. I have message: Import "sort.sort" could not be resolved.
Hey, make sure you clone 'sort' repository, in the video I explain two different ways to do it, starting from minute 17:21. 🙌
Hey bro which version of python is compatible with this algorithms
In your previous video I got landed into some compatibility issues that are solved after too much googling
Hey, in this tutorial I worked with Python 3.8. Other versions of Python should work as well. 🙌
Hi! Thanks for the tutorial,
Is it possible to use a remote camera instead of the .mp4 file?
Hey, you would need to make some adjustments in the code, but yes it is possible. 🙌
@@ComputerVisionEngineer I have the same question for the live camera can you please explain the steps in short It would very greatfull for us ?
file 'test.csv' doesn't work for me I got nothing in it , can you explain why? I downloaded the whole raspatory from your Github and followed every step😢😢
Please make next video on person re-identification and tracking using non overlapping cctv cameras using yolov7 or yolov8. I have been trying to make it since 2 weeks, but I am having difficulties in it, so plz help me.
I will try to do a video like that in the future., 🙌
From where can we get the licence plate model plz
Hi champ, I cloned this repository, but I can't find the model folder which you used to detect the license plate. If possible, can you provide me that. Pls it's a kind request
If you want the model you have to pay
Hello sir, I got these errors main.py", line 13, in
mot_tracker = Sort()
NameError: name 'Sort' is not defined thought I followed all your steps
Donde podemos encontrar los recursos del video o el fichero que se importa en el segundo modelo despues de coco_model?
Algunos recursos estan en github, el link esta en la descripcion. El modelo para detectar license plates esta disponible para mis Patreons. 🙌
Hello Felipe, greeting from Brazil! What do you suggest to perform the detection of two different patterns of license plates that appear in the same video?
Hey Gabriel, try this: for every license plate try reading it as each one of your patterns, then keep the one that is read with the highest confidence score. 🤔 Not a perfect solution, but it could work. 🙌🇧🇷
boa mano, voce conseguiu chegar a implementar isso?
I have some problems running it, how can I contact you ?
Hello Sir, could you do it all from scratch without using any libraries
Can you do the same but with shipping containers that are put to the ground from a crane and track them along with their IDs that are located on them?
That sounds like a cool project, I will try to find a dataset in order to make a video about that! 💪
Dear Felipe,it's a wonderful video huge thanks for you..
I followed your video but got stuck as my test.csv file has no data in it as it produced and my terminal keeps running for a long time plzz help me
The csv file you are producing is empty? Take a look the column names, they should match with the ones I am using in the video.
Hello, can you help me with the License Plate Recognition? I don't know where should I download the "./models/license_plate_detector.pt" from, and I really need some help
same issue , please help
Exactly I am facing same..
You have to train the model by yourself on above mentioned roboflow dataset.
Is there a reason you choose to use abewley/sort instead of yolo's built-in tracking?
Estou com a mesma dúvida.
@@olhodetigre777 No reason. I hadn't had the time to familiarize myself with yolov8 built in tracking before making the video. 🙌
Hello, that's a great work, thank you. Where can i dowland sample video btw?
Hello, the sample video is from pexels www.pexels.com/video/traffic-flow-in-the-highway-2103099/ 🙌