Object Tracking with YOLOv8: Vehicles Tracking, Counting (Entering & Leaving) and Speed Estimation
ฝัง
- เผยแพร่เมื่อ 8 ก.พ. 2023
- #ObjectDetection #ObjectTracking #SpeedEstimation #yolov8 #yolo #computervision #deeplearning #ai #machinelearning #opencv #opencvpython #pytorch
--------------------------------------------------------------------------
Code Available:
Google Colab File Link:
colab.research.google.com/dri...
Github Repo:
github.com/MuhammadMoinFaisal...
-----------------------------------------------------------------------------------------------------------------------------
If you enjoyed this video, be sure to subscribe and press the 👍 button
🧑🏻💻 My AI and Computer Vision Courses⭐:
📙 YOLOv9: Learn Object Detection, Tracking with WebApps (13$):
www.udemy.com/course/yolov9-l...
📕 Learn LangChain: Build #22 LLM Apps using OpenAI & Llama 2 (13$):
www.udemy.com/course/learn-la...
📚 Computer Vision Web Development: YOLOv8 and TensorFlow.js (13$):
www.udemy.com/course/computer...
📕 Learn OpenCV: Build # 30 Apps with OpenCV, YOLOv8 & YOLO-NAS (13$):
www.udemy.com/course/learn-op...
📗 YOLO-NAS, OpenAI, SAM with WebApps using Flask and Streamlit (13$): www.udemy.com/course/yolo-nas...
📘 YOLO-NAS The Ultimate Course for Object Detection & Tracking (13$): www.udemy.com/course/yolo-nas...
📙 YOLOv8: Object Detection, Tracking & Web Apps in Python 2023 (13$) : www.udemy.com/course/yolov8-t...
📚 YOLOv7 YOLOv8 YOLO-NAS: Object Detection, Tracking & Web Apps in Python 2023 (13$): www.udemy.com/course/yolov7-o...
Follow Me:
LinkedIn: / muhammad-moin-7776751a0
GitHub: github.com/MuhammadMoinFaisal
Chat with us on Discord:
► / discord
For Consultation Call:
www.upwork.com/freelancers/~0...
--------------------------------------------------------------------------------------------------------------------------
YOLOv8 Object Tracking Github Repo:
github.com/MuhammadMoinFaisal...
Medium Profile:
/ m.moinfaisal
🧑🏻💻 My AI and Computer Vision Courses⭐:
📙 YOLOv9: Learn Object Detection, Tracking with WebApps (13$):
www.udemy.com/course/yolov9-learn-object-detection-tracking-with-webapps/?couponCode=MAY13DOLLAR
📕 Learn LangChain: Build #22 LLM Apps using OpenAI & Llama 2 (13$):
www.udemy.com/course/learn-langchain-build-12-llm-apps-using-openai-llama-2/?couponCode=MAY13DOLLAR
📚 Computer Vision Web Development: YOLOv8 and TensorFlow.js (13$):
www.udemy.com/course/computer-vision-web-development/?couponCode=MAY13DOLLAR
📕 Learn OpenCV: Build # 30 Apps with OpenCV, YOLOv8 & YOLO-NAS (13$):
www.udemy.com/course/learn-opencv-build-30-apps-with-opencv-yolov8-yolo-nas/?couponCode=MAY13DOLLAR
📗 YOLO-NAS, OpenAI, SAM with WebApps using Flask and Streamlit (13$): www.udemy.com/course/yolo-nas-object-detection-tracking-web-app-in-python-2023/?couponCode=MAY13DOLLAR
📘 YOLO-NAS The Ultimate Course for Object Detection & Tracking (13$): www.udemy.com/course/yolo-nas-the-ultimate-course-for-object-detection-tracking/?couponCode=MAY13DOLLAR
📙 YOLOv8: Object Detection, Tracking & Web Apps in Python 2023 (13$) : www.udemy.com/course/yolov8-the-ultimate-course-for-object-detection-tracking/?couponCode=MAY13DOLLAR
📚 YOLOv7 YOLOv8 YOLO-NAS: Object Detection, Tracking & Web Apps in Python 2023 (13$): www.udemy.com/course/yolov7-object-detection-tracking-with-web-app-development/?couponCode=MAY13DOLLAR
Hi, I want to get all the detected object information per frame. So, in one frame if there is 2 car and 1 person detected it would print:
frame 1, car 1(tracking ID), bbox info, other metdata (color of the car, etc.), timestamp,....
frame 1, car 2.....
frame 1, person 1....
frame 2....
Like this. I am trying to do that from the write results script, but it writes a summary of the frame. Could you please help me how to do it?
Hi great job done. Is it possible to add in timestamp to make analysis on which time frame has more traffic?
Hi Muhammad, I really like your video
I have some doubts, I don’t understand how you drew the line to count the veichles. How can I draw two lines in the video and get the exact time the objects pass through them and register the time in a sheet?
Thank you
Hello Muhammad, great work, I am seeing some obvious forgotten variable, which by chance I am working on a solution. The perspective has a direct influence on screen speed, but if you do a perspective transform (which by now would be manual input) you can get the bird view of the camera. The result will be very distorted, but it will allow to proportionate detection velocity of the detections.
Hi Alex, Thanks a lot for sharing this information i will look into it
Thanks
Thank you soo much broski
Thanks sir, that great work. But, how i can use custome model on this project?
Hi sir, I want to use a custom video with two classes. Can you please help me to count the two objects. I tried running the code but it is giving errors. Please help
can you make videos on this topic Traffic flow tracking at an intersection based on direction-to-direction analysis involves detecting vehicles and determining their movement direction within predefined regions
what is the spec of the device you are running these models on ?
Excelente
we can modify car_id by amount of seats that cars have! or not. And if can, can you tell me how to do that Thanks
hello sir. its a great video for learning.
If i need to detect only the vehicles but not human beings, what should i do?
if i need to change the dataset, at which directory i should exactly make the changes.
please reply sir.
I want to send class over TCP IP using yolov5 but condition is when TCP IP is connected else skip sending and save class in text and continue monitoring for connection reconnecting. I am working on a detect.py file in the yolov5 repository .Advanced thanks.
Hello Muhammad Moin, how i can run this model on GPU?
Can u make it for yolov9 aswell same or anything vehicle number detection with yolov9
.you explain really well sir
Good explanation Sir
Thanks and welcome
hi sir is this code valid for real time vehicle tracking, countingand also for speed?
How to solve the - "AttributeError: module 'numpy' has no attribute 'float'. np.float was a deprecated alias for the builtin float."
Where is the speed estimation code??? Cant see it in the repo?
Nice Tutorial
Thanks
Assalamualaikum bro, can this be made into real time?
Very good
Thanks
I am facing an error. It is telling me to do "set the environment variable HYDRA_FULL_ERROR=1 for a complete trace. What should i do?
yes same here ,same error encountered
@@aparnabapuram5600what u did to solve it?
Install a numpy version less than 1.24
great video, which python version did you use?
Hi Mendis, i am using Python 3.10
thank u
Welcome
Hi,When I input pip install -e '.[dev]' ,there show ERROR: '.[dev]' is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https
, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file). I can't solve it although I use stackoverflow,Can you help me?
try pip install -e ".[dev]"
thank you, it works@@ayknes7944
why the hEll everone is using open cv i dont see any experts working without open cv
hello sir i am getting the error
FileNotFoundError: C:\Users\Hem Raj\Desktop\Vehicle monitoring\YOLOv8-DeepSORT-Object-Tracking\ultralytics\assets does not exist
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
same error
any solution?
Paste the error in chat gpt it will give you the errors and correction and it will get resolved
Thanks sir great work. The speed seems to be low comparing to what it should be in real any explanation please? And i think in the speed estimation speed = distance / time.
Hi @Youssef, we have set the time constant = 15 *3.6, 15 represents the frame per second while 3.6 is the constant which we can adjust,
and yes as speed = distance/time, but here we are doing speed = d_meters * time_constant, because we have frequency here in this case as frequency = 1/time so we will have speed = d_meters*time_constant
Thanks sir. And for the low speed did you please identify the source problem?
hi, I got some errors like settings.keys() == defaults.keys() \
AttributeError: 'NoneType' object has no attribute 'keys'. Plz help me
Hi @Nhan, please email me the screenshot of the error at m.moinfaisal@gmail.com
@@muhammadmoinfaisal I did send the email . Please help me double check
Can you share me the full code including estimation part as well where it shows the speed of car!
Hi Smit, Good news i have made the code public and i have added the links in the video description please check it
Thanks
Thank you so much 😊🙌🏻
i followed all steps u mentioned, but when i run the test.mp4 video in pycharm i get this :
Fusing layers...
YOLOv8l summary: 268 layers, 43668288 parameters, 0 gradients, 165.2 GFLOPs
Error executing job with overrides: ['model=yolov8l.pt', 'source=test3.mp4', 'show=True']
Traceback (most recent call last):
File "C:\Users\ASUS\Documents\DeepSORT_Tutorial1\pythonProject1\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect
\predict.py", line 253, in predict
predictor()
and other similar errors after it. i checked predict.py file and i had every "from ultralytics.yolo etc." underlined in red. (total of 12 errors and few warnings)
please help
did you solved the probem?
@@niloybiswas9113 no i didn't 😭 i changed the project completely and the code editor to Thonny
from 8:17, I can't hear your voice. Please check. thank you
Hi, thanks for the great video. I am getting the following error: ModuleNotFoundError: No module named 'easydict' when I try to run the code,
python predict.py model=yolov81.pt source="test3.mp4" show=True
pip install easydict in the terminal may be this will solve it
hello sir, can i implementation this deepsort in yolov5? thank you
HI M Rafly, Yes you can implement YOLOv5 and DeepSORT object tracking and there are many open source code available on github as well
Please how do you get pixel of meter of video?
Hi @Youssef, currently we have set the pixel per meter as 8 but we can make it dynamic like close to camera 1 and away from camera 20, to get more better results
what about using my own video on gogel colab for trying ?
Yes you ca use your own video as well
dataset pls??
how to increase video speed in this project? me using cpu
If you are using CPU than FPS will be low and video processing will also be very low, but you can use Google Colab it offers free GPU.
hello i have error when i want to detect object and tracking, pls help me.
from ultralytics.yolo.engine.predictor import BasePredictor
ModuleNotFoundError: No module named 'easydict'
Sir could you please share the speed estimation code as well
me too
Hi, Apologies for the delay in reply i was away, here is the Google Colab File Link, it contains the step by step implementation details with speed estimation code as well
Google Colab File Link:
colab.research.google.com/drive/1nPGcKGB2ZGO1s8qlflXoWVpIkMlT2J5L?usp=sharing
Thanks
Hello sir
can you guys have voice in this video after 8.15min
can i do this in vscode?
yes u can. but for some reason, i already installed hydra, yet it still display no module named 'hydra'
from this question, I said that this tutorial not for beginner. Learn from fundamental, never skip if u want to learn something, it will help you in the future. Of course you can use notepad for this tutorial too.
Hello Sir , I have an error is that when I run pip install -e '.[dev]' , then error is shows below like is ..... Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'D:\SW Part\Engineering Tools\pythonProject\venv\Scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'D:\\SW Part\\Engineering Tools\\pythonProject\\YOLOv8-DeepSORT-Object-Tracking\\setup.py'
"'"'; __file__='"'"'D:\\SW Part\\Engineering Tools\\pythonProject\\YOLOv8-DeepSORT-Object-Tracking\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools i
mport setup; setup()'"'"');code = f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\10008296\AppData\Local\Temp\pip-pip-egg-info-addy7_ky'
cwd: D:\SW Part\Engineering Tools\pythonProject\YOLOv8-DeepSORT-Object-Tracking\
Complete output (9 lines):
Traceback (most recent call last):
File "", line 1, in
File "D:\SW Part\Engineering Tools\pythonProject\YOLOv8-DeepSORT-Object-Tracking\setup.py", line 23, in
version=get_version(), # version of pypi package
File "D:\SW Part\Engineering Tools\pythonProject\YOLOv8-DeepSORT-Object-Tracking\setup.py", line 18, in get_version
return re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', file.read_text(), re.M)[1]
File "C:\Users\10008296\AppData\Local\Programs\Python\Python310\lib\pathlib.py", line 1133, in read_text
return f.read()
UnicodeDecodeError: 'cp950' codec can't decode byte 0xf0 in position 19: illegal multibyte sequence
----------------------------------------
WARNING: Discarding file:///D:/SW%20Part/Engineering%20Tools/pythonProject/YOLOv8-DeepSORT-Object-Tracking. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Could not fetch URL pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLEOFError(8, 'EOF o
ccurred in violation of protocol (_ssl.c:997)'))) - skipping
plz share speed estimation code
Hi, Apologies for the delay in reply i was away, here is the Google Colab File Link, it contains the step by step implementation details with speed estimation code as well
Google Colab File Link:
colab.research.google.com/drive/1nPGcKGB2ZGO1s8qlflXoWVpIkMlT2J5L?usp=sharing
Thanks
I followed your instructions and now it broke my Python and Yolov8 installation. Why did your code update my global Python configuration? Good news, I can run your example. Bad news, I can't run anything else. I can't figure out how to get the speed estimation like in the video title, where is this?
from deep_sort_pytorch.utils.parser import get_config
ModuleNotFoundError: No module named 'deep_sort_pytorch'
Hi John,
You are getting this error because you have not placed the DeepSORT files in the right folder
Thanks
hi i am not able to run this line ----gdown "drive.google.com/uc?id=1rjBn8Fl1E_9d0EMVtL24S9aNQOJAveR5&confirm=t"--- as i'm getting error for this
same
any solution?
same here any solution?
Pip install gdown