Vehicle speed detection | Step by step tutorial

Поділитися
Вставка
  • Опубліковано 31 січ 2025
  • Explained how to estimate the speed of a vehicle using yolov8 and speed calculation formula.
    Github: github.com/Aar...
    ****************************************************************
    For queries: You can comment in comment section or you can email me at aarohisingla1987@gmail.com
    ***********************************************************
    A speed estimation application for vehicles can be helpful in several ways:
    Traffic Management: It can assist traffic authorities in monitoring and managing traffic flow by identifying congested areas or potential traffic violations.
    Law Enforcement: Police officers can use it to enforce speed limits and identify vehicles that are speeding, aiding in the prevention of accidents and ensuring road safety.
    Accident Reconstruction: In the event of an accident, a speed estimation application can provide valuable data for accident reconstruction, helping investigators determine the cause and contributing factors.
    Fleet Management: Companies with vehicle fleets can use speed estimation to monitor the driving behavior of their drivers, ensuring adherence to company policies and promoting safe driving practices.
    Insurance Purposes: Insurance companies can use speed estimation data to assess risk and determine premiums for individual drivers or fleets.
    Emergency Response: Emergency services can benefit from knowing the speed of vehicles in real-time, allowing them to respond more effectively to accidents, emergencies, or incidents on the road.
    Navigation Systems: Speed estimation can enhance navigation systems by providing more accurate estimated arrival times based on current traffic conditions and speed data.
    Transport Planning: Urban planners and transportation authorities can use speed estimation data to analyze traffic patterns, optimize road networks, and plan for future infrastructure improvements.
    Overall, a speed estimation application can contribute to safer roads, more efficient transportation systems, and improved decision-making for various stakeholders involved in managing and using road networks.
    #yolo #computervision #yolov8 #objectdetection #objecttracking

КОМЕНТАРІ • 85

  • @TarunaChaudhary-n2j
    @TarunaChaudhary-n2j Місяць тому

    Thanks Aarohi for the best explanation 🙏

  • @Sunil-ez1hx
    @Sunil-ez1hx 11 місяців тому

    Mam your videos are really very much helpful in my office assignments on AI. Its worth watching again & again. Is it possible for you to help us in our ongoing project?

    • @CodeWithAarohi
      @CodeWithAarohi  11 місяців тому

      Thanks for your kind words. Email me at aarohisingla1987@gmail.com for project discussion.

  • @arnavthakur5409
    @arnavthakur5409 11 місяців тому

    Nice & easy way to explain these difficult concepts. Thank u

  • @ashimasingla103
    @ashimasingla103 11 місяців тому

    Keep up the good work Aarohi.

  • @soravsingla8782
    @soravsingla8782 11 місяців тому

    It’s very informative video. Your content is really unique, way of explanation is so good that anyone can understand it easily. I appreciate your efforts & wish your channel to get justice with more subscribers & viewers. #BestAITutorials

  • @bayramdogan3501
    @bayramdogan3501 2 місяці тому

    thank you for your video it is very explanatory

  • @SabbirAhmed-l1h
    @SabbirAhmed-l1h 11 місяців тому

    Thank you so much Aarohi for explaining in details. I am facing a different problem. There is a scenario where a small vehicle may be positioned at the center of the frame, but becomes obscured by a larger vehicle passing by, causing the bounding box around the small car to resize. Consequently, the center of the small vehicle is not consistently located. How can this challenge be effectively addressed?

    • @CodeWithAarohi
      @CodeWithAarohi  11 місяців тому

      1- If you can detect the presence of the larger vehicle approaching the small vehicle, you can anticipate the occlusion and adjust the tracking accordingly.
      2-You can maintain temporal consistency by incorporating information from previous frames. Even if the small vehicle is momentarily obscured, you can use its previous positions and motion patterns to estimate its current position more accurately.
      2- And for the center of the small vehicle is not consistently located - You can try working with the algorithms which are good at detecting small objects. Also, if you think that your current training dataset have more training on large vehicles as compare to small vehicles then you can add more images where the vehicles are small and train your model on it.

  • @winkertkhut7425
    @winkertkhut7425 7 місяців тому

    Awesome work Aarohi. Thank you for sharing this tutorial that helps us to have a better understanding on how it works. Is it possible to have multi-task from a single input, it will generates more information output. Like ANPR, Vehicle Colour Recognition (VCR), Vehicle Make/Model and Vehicle.
    Thanks

    • @CodeWithAarohi
      @CodeWithAarohi  7 місяців тому

      Yes, it is possible to perform multiple tasks from single input

    • @winkertkhut7425
      @winkertkhut7425 7 місяців тому

      @@CodeWithAarohi Could you make a video of it please.

  • @guruprasadr6743
    @guruprasadr6743 9 місяців тому

    Instead of using time.time(). I would suggest that you use the fps to calculate the time elapsed, otherwise the calculations would be erroneous on slower processor. What you can do is use this Elapsed Time = (No. of frames between red line and blue line)/FPS. You can get the FPS from the properties in mp4 in Windows.

    • @CodeWithAarohi
      @CodeWithAarohi  9 місяців тому

      Thanks for the suggestion! I appreciate your input :)

    • @adityaagarwal9484
      @adityaagarwal9484 9 місяців тому

      thank you brother!! that was the problem i was getting

    • @vinayagrawal5506
      @vinayagrawal5506 8 місяців тому

      what do you mean by No. of frames between red line and blue line? Is it the number of frames a vehicle takes to cross the distance between those two lines?

  • @pifordtechnologiespvtltd5698
    @pifordtechnologiespvtltd5698 11 місяців тому

    Impressive video👍👍

  • @ShivaNaroju-lz9sz
    @ShivaNaroju-lz9sz 11 місяців тому +1

    Mam, ive trained a yolo v8 segmentation model, how can we connect that midel to a webpage?

    • @CodeWithAarohi
      @CodeWithAarohi  11 місяців тому

      You can use a web framework like Django or Flask and then deploy it on server. You can use platforms like AWS, Google Cloud, Heroku, or your own server if you have one.

  • @wayivp4280
    @wayivp4280 7 місяців тому

    The distance between two columns on the highway is 50 meters.

  • @brajeshkumar5451
    @brajeshkumar5451 11 місяців тому

    Thank you ma'am for making this type of great video, ma'am can you explain how to train your model in coco datasets

  • @nagendrareddy6984
    @nagendrareddy6984 11 місяців тому

    your videos are very useful , i request can you please make a video on " power line insulator defect detection by yolo " - if you willing to next video on this . heart fully Thank You

  • @tahseenabbas52
    @tahseenabbas52 11 місяців тому

    Thanks for sharing such an informative content, i have a question regarding the logic that what if the processing of the system is slower than the usual will it effect the speed as the frames are being processed at lower fps while we are recording the time at the frame object touches the lines and the time of system is increasing at its own regardless of the program.

    • @CodeWithAarohi
      @CodeWithAarohi  11 місяців тому +1

      Yes, it will effect the speed.

    • @tahseenabbas52
      @tahseenabbas52 11 місяців тому

      @@CodeWithAarohi Then is there any alternate method like where we involve the actual fps being processed so we can get actual speed ?

  • @grayelearning772
    @grayelearning772 10 місяців тому

    Good explanation of the concepts and code. How we can save frame by frame results into output.avi ? please share the code

    • @CodeWithAarohi
      @CodeWithAarohi  10 місяців тому

      You can do something like this:
      import cv2
      fourcc = cv2.VideoWriter_fourcc(*'XVID')
      output_video = cv2.VideoWriter('output.avi', fourcc, 20.0, (width, height))
      for frame in frames:
      output_video.write(frame)
      output_video.release()

  • @pawansharma-mi6ce
    @pawansharma-mi6ce 5 місяців тому

    please make the video on. estimation of vehicle speed of different type of vehicle

  • @rednax25
    @rednax25 11 місяців тому

    I have a question. How did you deduce the distance is 10 meters between the blue and red line. Is it assumed or it’s calculated or deducted.

    • @CodeWithAarohi
      @CodeWithAarohi  11 місяців тому

      It is assumed for this video but for real applications you should calculate this.

    • @wayivp4280
      @wayivp4280 7 місяців тому

      @@CodeWithAarohi We don't need any extrapolation; the distance between two columns on the highway is 50 meters.

  • @Aviationdaily223
    @Aviationdaily223 5 місяців тому

    Is it possible to add a webcam and detect live?

  • @KRISHNASREEBRAHMADEVARA
    @KRISHNASREEBRAHMADEVARA 3 дні тому

    can you tell me what dataset did you use for this

  • @jazz5919
    @jazz5919 3 місяці тому

    if i want do this on google colab, the syntax and procedures would be about the same, right?

    • @CodeWithAarohi
      @CodeWithAarohi  3 місяці тому

      Yes, Entire code will be same. You just need to change the paths of the files

    • @rikzamaulana7149
      @rikzamaulana7149 3 місяці тому

      but you can't show with cv2. colab not support it

  • @pawansharma-u3j
    @pawansharma-u3j 5 місяців тому

    make video on bicycle and motorbike speed calculation

  • @jamalblack3108
    @jamalblack3108 11 місяців тому

    Good explanation of the concepts and code. Thank you

  • @paulmobley9645
    @paulmobley9645 7 місяців тому

    Can you help me with a rural mountain community with problematic speeders on mountain roads?

  • @SaadDalvi-lt6lx
    @SaadDalvi-lt6lx 10 місяців тому

    I have implemented it but it is only detecting speed in 10 km/hr and 9km/hr
    please tell me how can i resolve this problem I am using your reference for my project

  • @ADITYASINGHthesoftwareengineer
    @ADITYASINGHthesoftwareengineer 11 місяців тому

    what if tracking is missed , you won't have the information to calculate speed

    • @CodeWithAarohi
      @CodeWithAarohi  11 місяців тому

      If tracking is missed, it means that you lose the continuous information about the vehicle's position over time. Without this continuous information, calculating the speed becomes challenging or impossible until the tracking is re-established.

    • @ADITYASINGHthesoftwareengineer
      @ADITYASINGHthesoftwareengineer 11 місяців тому

      @@CodeWithAarohi First of all your contents are very helpful and I have watched several videos for architecture understanding.

    • @ADITYASINGHthesoftwareengineer
      @ADITYASINGHthesoftwareengineer 11 місяців тому

      @@CodeWithAarohi And we are working on same usecase and the same logic, we are using multiple lines and deep sort for tracking, but the problem we are facing is issue with the tracking.

    • @CodeWithAarohi
      @CodeWithAarohi  11 місяців тому

      which dataset you are using and have you tried the BoT-SORT tracker and ByteTrack tracker.

  • @Fukuiz
    @Fukuiz 8 місяців тому

    how we will know the coordinate for using to create the line?

    • @CodeWithAarohi
      @CodeWithAarohi  8 місяців тому

      one of the way is: roboflow.github.io/polygonzone/

  • @millgunay6570
    @millgunay6570 9 місяців тому

    how did you get the distance between the two lines?

  • @hridoydev8730
    @hridoydev8730 8 місяців тому

    I couldn't import the tracker library and I code in the google colab. it shows me that "cannot import name 'izip_longest' from 'itertools'". what should I do pls help me?

    • @CodeWithAarohi
      @CodeWithAarohi  8 місяців тому

      tracker is a file which is present in github repo github.com/AarohiSingla/Speed-detection-of-vehicles

  • @AnhTuanNguyen-yy5kv
    @AnhTuanNguyen-yy5kv 3 місяці тому

    thank you. How to fix bug : ModuleNotFoundError: No module named 'torch._prims_common'

    • @CodeWithAarohi
      @CodeWithAarohi  3 місяці тому

      This error could have been caused by an incomplete install or uninstall of your torch package. To check, see if there is any directory called “~orch” in your python path. You can find this folder in site-packages of python. If there it is, simply delete the directory and uninstall and reinstall your torch package and the missing modules should be there in the new installation.

  • @aswinielangovan6383
    @aswinielangovan6383 3 місяці тому

    how to install ultralytics

    • @CodeWithAarohi
      @CodeWithAarohi  3 місяці тому

      @@aswinielangovan6383 just run pip install ultralytics

  • @saaddalvi9647
    @saaddalvi9647 10 місяців тому

    Can I know which GPU you are using

  • @mohammadtarekchowdhury1061
    @mohammadtarekchowdhury1061 11 місяців тому

    Hello, can I use techniq on yolov9?

  • @ugempireninjaaaaaahatori6755
    @ugempireninjaaaaaahatori6755 9 місяців тому

    Thanks alot

  • @serucodingai
    @serucodingai 11 місяців тому

    Can you provide yolov8 obb tutorial

  • @فاطمهمیرابی-ق2و
    @فاطمهمیرابی-ق2و 10 місяців тому

    why speed incorrect?

    • @CodeWithAarohi
      @CodeWithAarohi  10 місяців тому

      Speed will be an estimate and may not be completely accurate. Additionally, the estimation can vary depending on GPU speed.

  • @kdslegend4152
    @kdslegend4152 11 місяців тому

    Why my speed is coming 8km/hr or 6km/hr

    • @CodeWithAarohi
      @CodeWithAarohi  11 місяців тому +1

      Speed estimation may vary depending on GPU speed.

  • @hafeezurrehman2279
    @hafeezurrehman2279 6 місяців тому

    Can I get this code

    • @CodeWithAarohi
      @CodeWithAarohi  6 місяців тому

      github.com/AarohiSingla/Speed-detection-of-vehicles