Real-time License Plate Recognition with YOLOv7 + OCR in Google Colab GPU | ANPR/ALPR Tutorial 2023

Sdílet
Vložit
  • čas přidán 1. 06. 2024
  • Join Rama, Co-founder and CEO of Theos AI, as he demonstrates how to perform real-time license plate recognition using YOLO v7 and OCR. This tutorial will guide you through setting up your environment, using Google Colab, and performing object detection on license plates in a near real-time scenario.
    🚀 Sign up for free at Theos AI and join our community for more exciting AI and machine learning content!
    *Chapters*:
    00:00 - Introduction
    00:07 - Overview of Object Detection with YOLO v7
    01:02 - Setting Up the License Plate Recognition Model
    02:02 - Google Colab Notebook Walkthrough
    03:08 - Implementing OCR on Detected License Plates
    07:00 - Running the Complete Model and Testing
    10:52 - Final Results and Downloading the Output Video
    14:38 - Conclusion and Further Resources
    *Links and Resources*:
    🥳 [Sign up now for free at Theos AI](theos.ai/ref/yt:FKGtdSJu3X4/home)
    👋🏻 [Join our discord server]( / discord )
    ✅ [Join our WhatsApp group](chat.whatsapp.com/CzlqpwU9rID...)
    🚘 [License Plate Detection Tutorial Video]( • How to Train YOLO v7 o... )
    ✅ [Google Colab Notebook](colab.research.google.com/dri...)
    📚 [Official Theos AI documentation](docs.theos.ai/deployment#use-...)
    ⚡️ [Clone the Easy YOLOv7 repo](github.com/theos-ai/easy-yolov7)
    *Team Connections*:
    - Founder and CEO: [Rama Castro]( / ramacastro )
    - Founder and President: [Nicolas Cantoli]( / nicolascantoli )
    Thanks for watching! Like, subscribe, and share if you found this tutorial helpful. Stay tuned for more AI and computer vision content.
  • Věda a technologie

Komentáře • 87

  • @sebaarr
    @sebaarr Před rokem

    Hi! Great job, it looks amazing. It's possible to download the weights after train?

    • @theos-ai
      @theos-ai  Před rokem +1

      Hi, thanks! Yes of course it's possible! check this out: github.com/theos-ai/easy-yolov7#click-the-weights-button

    • @sebaarr
      @sebaarr Před rokem

      @@theos-ai Thanks a lot! :)

  • @luchador191
    @luchador191 Před rokem +1

    Thank you for your great project!Instead of inputting a video for my university homework, I need to do it in real time with the ESP32 Cam. I need to detect the plate from the camera, keep the plate code in communication with the Arduino and use it. After training YOLO, how can I do plate detection and text extraction with ESP32 Cam? I will be grateful if you help

    • @theos-ai
      @theos-ai  Před rokem

      Hi 👋🏻! take a look at our new Easy YOLOv7 GitHub repository: github.com/theos-ai/easy-yolov7
      We show how to easily use YOLOv7 in real-time with any camera (even livestream). Here's the CZcams tutorial: czcams.com/video/KFZW8p-o2fA/video.html
      Then you can follow the same instructions I show in the real-time license plate video to read the text.

    • @hardishah3188
      @hardishah3188 Před rokem

      heyy have u tried doing it? how were the results??

    • @luchador191
      @luchador191 Před rokem

      @@hardishah3188 I did it with my computers webcam instead of ESP32CAM 5 months ago. 🙂

    • @maddestruction1
      @maddestruction1 Před 2 měsíci

      @@luchador191 I need to do it in real-time too but when a license plate is detected it outputs the number multiple times as long as it is still in the frame. How did you approach this issue?

  • @mabroukhamid6879
    @mabroukhamid6879 Před měsícem +1

    please How do I obtain the training accuracy?

  • @pratyushpandey9126
    @pratyushpandey9126 Před rokem

    Amazing work.... but i have a question will it work offline once trained and downloaded????

    • @theos-ai
      @theos-ai  Před rokem

      Thanks! yes definitely, it works offline.

  • @nourabdelghany6847
    @nourabdelghany6847 Před rokem

    Thanks for your great efforts!...Can I enter my own datasets if I want to detect "Egyptian" license plates?

    • @theos-ai
      @theos-ai  Před rokem +1

      Yes you can! sign up to theos.ai and start labeling your own dataset! also join our community from the links in the description so we can help you.

  • @kishoreg8835
    @kishoreg8835 Před rokem +5

    i have a question - insted of using ocr model. can i train my yolo v7 model to detect alphabets and numbers .. classes will be car, lp, 0-9, A-Z. isn't this better than using two different detection.

    • @theos-ai
      @theos-ai  Před rokem +3

      We tried this before but it didn't work very well. Mainly because it's hard to get a good class balance on the alphabet. You would need a lot of labeled data for this. But If you want to try, please let us know if it worked better for you, good luck!

    • @kishoreg8835
      @kishoreg8835 Před rokem

      cool.

  • @saifnacer4532
    @saifnacer4532 Před rokem

    Thank you , it looks amazing , It's possible to work on my local machine not on colab , if yes can you please tell me how ??

    • @theos-ai
      @theos-ai  Před rokem +1

      Thanks! Yes of course you can. Install all the dependencies shown in the first cell and then copy and paste the code cells in a script.py file and run it.

  • @dayalan81
    @dayalan81 Před rokem

    Great work. Will this run on mobile phone s?

    • @theos-ai
      @theos-ai  Před rokem +1

      Thanks! yes for sure. Maybe not in real-time but it works.

  • @aliali-sj9jp
    @aliali-sj9jp Před rokem

    hay thanks to let me know about the great theos and for the great lesson ,this is my question please :
    in the Detect and read script
    Replace configuration variables with my own values.
    can i do it this way because i deleted my weight tag from my theos session but before deleted i download the weights Hopeing that will have a way to implement it in this way WEIGHTS = '/content/drive/MyDrive/best.weights'
    please explain to me what i can do now

    • @theos-ai
      @theos-ai  Před rokem

      Thanks! I'm afraid you can't use it like that in this colab notebook, you have to set the weights tag there. Try using your weights with easy yolov7: czcams.com/video/KFZW8p-o2fA/video.html

  • @varundeliwala2441
    @varundeliwala2441 Před rokem

    Hi rama, I am facing this error, in the last google colab cell,
    AttributeError: 'NoneType' object has no attribute 'get_installation_path'
    for the line number 16: yolov7 = client.get(ALGORITHM, version=ALGORITHM_VERSION)
    can you please help me out?

    • @theos-ai
      @theos-ai  Před rokem

      Hi Varun 👋🏻 did you run the previous cell where the settings variable are created? and did you previously train your own model on theos.ai and set the variables accordingly to your own model just like I show in the video?

  • @arazib8394
    @arazib8394 Před 6 měsíci

    Thanks for your training. Is it possible to read Asian languages like Farsi and how are you?

    • @theos-ai
      @theos-ai  Před 6 měsíci

      Yes it's definitely possible, send us an email to contact@theos.ai and we will help you. I'm good and you?

  • @jorgesk8iqq
    @jorgesk8iqq Před rokem

    Thank you a lot. I hope u can help me, i need know how to work in real time, save the plate, after it put it on a database whit date and time.

    • @theos-ai
      @theos-ai  Před rokem

      Sure, check out this video: czcams.com/video/KFZW8p-o2fA/video.html

  • @thisisrajatkumar
    @thisisrajatkumar Před rokem +1

    Hii.
    Can we setup this whole program in system and make use it by web cam.

    • @theos-ai
      @theos-ai  Před rokem +1

      Hi 👋🏻 yes! you can use it with your webcam, I show how to do it here: czcams.com/video/KFZW8p-o2fA/video.html

    • @thisisrajatkumar
      @thisisrajatkumar Před rokem +1

      @@theos-ai will it work offline because 8 have to setup it in my college.

    • @theos-ai
      @theos-ai  Před rokem

      Yes! It works offline

    • @pratyushpandey9126
      @pratyushpandey9126 Před rokem

      ​@@thisisrajatkumar have you tried it offline

  • @soumyakapat6537
    @soumyakapat6537 Před rokem

    Sir, how can I collect the license plate number in colab, because it is only showing in the output video only but I need the license plate number as a string?

    • @theos-ai
      @theos-ai  Před rokem

      after this line: "detections = ocr_model.read(frame, detections=detections, classes=OCR_CLASSES)" the detections variable is a list of dictionaries, and each dictionary has a "text" key where you can extract the string.

    • @soumyakapat6537
      @soumyakapat6537 Před rokem

      @@theos-ai Thank you very much 😊

    • @soumyakapat6537
      @soumyakapat6537 Před rokem

      @@theos-ai
      from theos.computer_vision.object_detection.utils import draw
      from theos.computer_vision import ocr
      from theos.client import Client
      from google.colab import files
      from tqdm import tqdm
      import torch
      import json
      import time
      import cv2
      import os
      if torch.cuda.is_available():
      torch.cuda.empty_cache()
      client = Client(inputs='.', outputs='.')
      yolov7 = client.get(ALGORITHM, version=ALGORITHM_VERSION)
      yolov7.load_weights(WEIGHTS)
      yolov7.to_gpu()
      if OCR_MODEL_TYPE and OCR_MODEL_ACCURACY:
      ocr_model = ocr.load(size=OCR_MODEL_SIZE, model_type=OCR_MODEL_TYPE, accuracy=OCR_MODEL_ACCURACY)
      else:
      ocr_model = ocr.load(size=OCR_MODEL_SIZE)
      if OCR_MODEL_SIZE == 'large':
      ocr_model.to_gpu()
      webcam = cv2.VideoCapture(0)
      if webcam.isOpened() == False:
      print('[!] error opening the webcam')
      try:
      while webcam.isOpened():
      ret, frame = webcam.read()
      if ret == True:
      detections = yolov7.detect(frame, track=True)
      detections = ocr_model.read(frame, detections=detections, classes=OCR_CLASSES)
      for d in detections:
      print(d['text'])
      detected_frame = draw(frame, detections, alpha=0.15)
      print(json.dumps(detections, indent=4))
      cv2.imshow('webcam', detected_frame)
      cv2.waitKey(1)
      else:
      break
      except KeyboardInterrupt:
      pass
      webcam.release()
      print('[+] webcam closed')
      yolov7.unload()
      Sir I tried this code for the opening of webcam in colab, but it always says that "[!] error opening the webcam".
      So please help me to solve this problem....

    • @theos-ai
      @theos-ai  Před rokem

      @@soumyakapat6537 You can't open the webcam in colab. Watch this tutorial to learn how to use the webcam with YOLOv7: czcams.com/video/KFZW8p-o2fA/video.html

  • @jeremyterrible1692
    @jeremyterrible1692 Před 4 měsíci

    can i use that dataset for other country or do i need to create my own?

    • @theos-ai
      @theos-ai  Před 4 měsíci

      Depends on the alphabet of your country. But you can create your own with Theos AI if needed.

  • @seanlowwei
    @seanlowwei Před rokem

    Hi there, I am new to machine learning. I have my own machine learning model, I have already used Theos ai to annotate and draw bounding boxes for 1000 images, may I know how I can export/download the json file for each image?

    • @theos-ai
      @theos-ai  Před rokem

      Hi, send me a WhatsApp message and I'll help you with this: +41784208194

  • @GhostRider-bn3tk
    @GhostRider-bn3tk Před rokem

    Sir am getting "these weights don't exist or you don't have access to them. Please remember to set the project key if the weights are private" ...
    Please help me with that Sir....🥺

    • @theos-ai
      @theos-ai  Před rokem

      Hi Ghost! 👻
      Did you follow all the steps? You have to upload the dataset and train the model. Then set the project key with the CLI and finally you will be able to download the weights.
      Join our discord server linked in the description so we can help you there in real-time.

    • @GhostRider-bn3tk
      @GhostRider-bn3tk Před rokem

      @@theos-ai K Sir... Thank u for ur reply...😍

  • @walidflux
    @walidflux Před rokem

    can you do the security camera video method please

    • @theos-ai
      @theos-ai  Před rokem +1

      Yes! will do it this week or the next, make sure to subscribe and turn on the notification bell so you know when I posted the video.

    • @yslronhepos3325
      @yslronhepos3325 Před rokem

      can you do a security cam plss hehe

    • @theos-ai
      @theos-ai  Před rokem

      Take a look at the new Easy YOLOv7 tutorial I made guys, I show how to use security cameras: czcams.com/video/KFZW8p-o2fA/video.html

  • @theelofiguy
    @theelofiguy Před rokem

    no weights with tag license-plates:experiment-1:best found for yolov7, help me please

    • @theos-ai
      @theos-ai  Před rokem

      Did you sign up to theos.ai and trained yolov7 tiny on a dataset called "license plates" ?

    • @theelofiguy
      @theelofiguy Před rokem

      @@theos-ai i just sign up

  • @coconutnut21
    @coconutnut21 Před rokem

    What model is faster to train yolov5 or yolov7?

    • @theos-ai
      @theos-ai  Před rokem

      They take roughly the same time. YOLOv7 tiny is the fastest to train because it's the smallest model.

  • @eduardourzua155
    @eduardourzua155 Před 9 měsíci

    Amazing music 13:30 what song is that ?

    • @theos-ai
      @theos-ai  Před 8 měsíci

      Once Upon a December (from Anastasia): open.spotify.com/track/2PCTrOWob0vs0io6pfGOYS?si=0d3bd0e78cf04349

  • @hema-ig1xk
    @hema-ig1xk Před rokem

    sir, can you teach us to use paddle OCR with custom data?

    • @theos-ai
      @theos-ai  Před rokem

      Hi hema! Sure we are working on that video currently! Make sure to subscribe and turn on the notification bell to be the first to see it when it comes out!

    • @hema-ig1xk
      @hema-ig1xk Před rokem

      @@theos-ai I see that you are trying to implement this on your website. to make training easier.... but is it possible for you to show us how to do the training normally using the repository. I can't tell my faculty that i used some library or website.... sorry if am asking for something unreasonable. there is no such tutorial online...so i could only ask you since you are kind enough to reply to us. it's ok if you can't...

    • @hema-ig1xk
      @hema-ig1xk Před rokem

      tutorial on Collab and machine if possible.

    • @theos-ai
      @theos-ai  Před rokem

      Why can't you tell them that you used a library? you will always be using a library, wether it is PyTorch, TensorFlow, NumPy, OpenCV, and all the others... the Theos pip library is no different: pypi.org/project/theos-ai/

    • @theos-ai
      @theos-ai  Před rokem

      Sure, we will make it on colab

  • @89Micro
    @89Micro Před rokem

    Hi! After training a custom model starting from the yolov7-tiny , the inference time grows a lot ( like 4 times longer). The dataset used is not so large (500-600 images). What could be the reason for this ?

    • @theos-ai
      @theos-ai  Před rokem

      Hi 👋🏻 Where are you running the model?

    • @89Micro
      @89Micro Před rokem

      @@theos-ai rookie mistake. Was using the cfg for the full yolo when training, not the one for tiny. Thanks for replying though!

  • @merazali7712
    @merazali7712 Před rokem

    Hi Thoes
    Can I use this code in Jetson nano.?

  • @sumitsrivatava
    @sumitsrivatava Před rokem

    How Can i save all the car numbers in a CSV file or display real time

    • @theos-ai
      @theos-ai  Před rokem

      Loop through the detections list, get the text with detection['text'] and then use this to save to a csv: www.codingem.com/python-write-to-csv-file/

    • @sumitsrivatava
      @sumitsrivatava Před rokem

      @@theos-ai Hi Theos, I tried but number plate information is not getting saved on csv.
      😪

    • @theos-ai
      @theos-ai  Před rokem

      @@sumitsrivatava why not?

  • @arifemreyaman2150
    @arifemreyaman2150 Před rokem

    hello sir how can ı reading license plate from camera.

    • @theos-ai
      @theos-ai  Před rokem

      Hi 👋🏻 check this out: github.com/theos-ai/easy-yolov7#detect-multiple-live-video-streams-in-parallel

  • @yurymiguel1943
    @yurymiguel1943 Před 6 měsíci

    [theos] importing yolov7 code...
    [theos] yolov7 code imported successfully
    [theos] loading yolov7...
    Traceback (most recent call last):
    File "", line 28, in
    File "/root/theos/system/computer-vision/object-detection/algorithms/yolov7/code/theos_setup/api.py", line 15, in load_weights
    weights_path = self.get_weights_path(weights)
    File "theos/computer_vision/object_detection/api.py", line 42, in theos.computer_vision.object_detection.api.ObjectDetectionAPI.get_weights_path
    theos.exceptions.WeightsNotFound: no weights with tag license-plates:experiment-1:best found for yolov7
    Can you help me?

    • @theos-ai
      @theos-ai  Před 6 měsíci

      Did you train a dataset called "license plates" with YOLOv7? if not probably you didn't follow the tutorial I provided on this video description: czcams.com/video/GVLUVxTpqG0/video.htmlfeature=shared

  • @haitamben9177
    @haitamben9177 Před 5 měsíci

    great work but i can't find the source code ?

    • @theos-ai
      @theos-ai  Před 5 měsíci

      It’s on the description of this video

  • @tamiltanny7
    @tamiltanny7 Před rokem

    where i can find the video

    • @theos-ai
      @theos-ai  Před rokem

      Hi 👋🏻 What video? If you're talking about the video where I trained the model, it's linked in the description of this video. You can also go to our channel page and find it there.

  • @timochyfilix5176
    @timochyfilix5176 Před 11 měsíci

    why do I have to login?

    • @theos-ai
      @theos-ai  Před 10 měsíci

      Because it's a platform, like AWS and Google Cloud but for Artificial Intelligence development.

  • @Arrobosys
    @Arrobosys Před 3 měsíci

    This is not working realtime it's Saving the vedio then it's playing

    • @theos-ai
      @theos-ai  Před 3 měsíci

      It's real-time. If you do it on your local computer you'll be able to see the output while it's detecting it.

  • @anshulparashar9743
    @anshulparashar9743 Před 10 měsíci

    Thanks for the informative video. I am trying to connect my local gpu using the 4 commands as mentioned in previous video. It is throwing me a error that it needs theos 0.0.34. But I am unable to install it as Ubuntu says package does not exist. And therefore I am unable to connect.
    Can you please provide a solution or your WhatsApp number so I can explain better.
    I have to critically test it as our organization might move for Theos Ai Pro if this is successful.

    • @theos-ai
      @theos-ai  Před 10 měsíci

      Hi, please send us a whatsapp message to +17372046474