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
Thanks Aarohi for the best explanation 🙏
I'm glad I could help! 😊
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?
Thanks for your kind words. Email me at aarohisingla1987@gmail.com for project discussion.
Nice & easy way to explain these difficult concepts. Thank u
Welcome
Keep up the good work Aarohi.
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
Thanks a lot 😊
thank you for your video it is very explanatory
Glad it was helpful!
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?
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.
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
Yes, it is possible to perform multiple tasks from single input
@@CodeWithAarohi Could you make a video of it please.
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.
Thanks for the suggestion! I appreciate your input :)
thank you brother!! that was the problem i was getting
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?
Impressive video👍👍
Thank you!
Mam, ive trained a yolo v8 segmentation model, how can we connect that midel to a webpage?
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.
The distance between two columns on the highway is 50 meters.
Thank you ma'am for making this type of great video, ma'am can you explain how to train your model in coco datasets
Will try
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
I will try
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.
Yes, it will effect the speed.
@@CodeWithAarohi Then is there any alternate method like where we involve the actual fps being processed so we can get actual speed ?
Good explanation of the concepts and code. How we can save frame by frame results into output.avi ? please share the code
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()
please make the video on. estimation of vehicle speed of different type of vehicle
Noted!
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.
It is assumed for this video but for real applications you should calculate this.
@@CodeWithAarohi We don't need any extrapolation; the distance between two columns on the highway is 50 meters.
Is it possible to add a webcam and detect live?
Yes, you can provide any source.
can you tell me what dataset did you use for this
Coco dataset or kitti dataset
if i want do this on google colab, the syntax and procedures would be about the same, right?
Yes, Entire code will be same. You just need to change the paths of the files
but you can't show with cv2. colab not support it
make video on bicycle and motorbike speed calculation
Good explanation of the concepts and code. Thank you
Glad it was helpful!
Can you help me with a rural mountain community with problematic speeders on mountain roads?
Sure, Ask your queries.
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
Which GPU or CPU you are using?
what if tracking is missed , you won't have the information to calculate speed
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.
@@CodeWithAarohi First of all your contents are very helpful and I have watched several videos for architecture understanding.
@@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.
which dataset you are using and have you tried the BoT-SORT tracker and ByteTrack tracker.
how we will know the coordinate for using to create the line?
one of the way is: roboflow.github.io/polygonzone/
how did you get the distance between the two lines?
I assumed
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?
tracker is a file which is present in github repo github.com/AarohiSingla/Speed-detection-of-vehicles
thank you. How to fix bug : ModuleNotFoundError: No module named 'torch._prims_common'
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.
how to install ultralytics
@@aswinielangovan6383 just run pip install ultralytics
Can I know which GPU you are using
RTX 3090
Hello, can I use techniq on yolov9?
I will cover that soon!
Thanks alot
Happy to help
Can you provide yolov8 obb tutorial
I will try!
ua-cam.com/video/KpwgPOPgX1M/v-deo.html
why speed incorrect?
Speed will be an estimate and may not be completely accurate. Additionally, the estimation can vary depending on GPU speed.
Why my speed is coming 8km/hr or 6km/hr
Speed estimation may vary depending on GPU speed.
Can I get this code
github.com/AarohiSingla/Speed-detection-of-vehicles