Object Tracking from scratch with OpenCV and Python
ฝัง
- เผยแพร่เมื่อ 7 ก.ย. 2024
- Blog : pysource.com/2...
In this special video, I'm going to help you solve the doubts you have about object tracking and you'll learn how to build an Object Tracking algorithm from scratch.
➤ Courses:
Full Computer Vision course: pysource.com/o...
Training Mask R-CNN PRO (Notebook + Mini-Course): pysource.com/m...
➤ Follow me on:
LinkedIn: / pysource
➤ For business inquiries:
pysource.com/c...
#ObjectTracking #AI #DeepLearning
►► You can Build a Computer Vision software to DETECT and TRACK any Object.
→ 4-Step FREE Workshop pysource.com/blueprint-workshop-signup/
Can we do this complete process in raspberry pi
I need the sources code
@@Abbababagana-sw6wd can share me source code?
Hi, I applied yesterday with my other to get contents, but still no response. Can you pls tell me how long it takes?
Man, I still don't have the money to pay for one of your courses, but I want to thank you a lot for all this free content. It's amazing how simple is your way of teaching, really nice to learn. Whenever I got a decent job in my country, I'm going to apply for your course.
Yeah, he is the best
When you're calculating cx you're basically multiplying x by 2 and then dividing it again by 2 and it looks a little bit counter intuitive. writing it as x + (w/2) is a bit more clear, same goes with cy = y + (h/2)
A very Thank you to Pysource who came up with this Project. He explains everything in a lucid manner. This is going to be my "Digital Image Processing Project" in my collage. Thank You BUDDY.
Thanks Sergio for such a great tutorial. This was just what I was looking for... a basic tracking algorithm that allows you to develop an intuition on how object tracking works and facilitates the understanding of more advanced tracking algorithms, such as the ones you have mentioned (Sort and DeepSort). Greetings from Ecuador 🇪🇨
Excellent tutorial - you let the student think together with you to develop a strategy, implement and debug it. This type of training is as good as it gets. Thank you!
thank you for this basic introduction to Opencv for those who have little or no experince with it, I look forward to watching more of your video / guides and hopefully get a better understanding of how it works. Thank you., Subbed and Liked for future learning.
Obrigado pela paciência e compreensão, este é um dos videos mais didáticos que é possível encontrar no youtube, por favor continue
Thakns a lot , in some projects we just can't use common algorithms like deep sort , what you did was just what i was looking for
I’ve watched hours of videos and tNice tutorials one is the first that explains it in a way a complete beginner could understand! Great video
Thanks for the video
I have a task which is pedestrian detection and congestion measurement
I need to build a model that can detect pedestrian and also be able to say if the frame is congested
For example let's say in a frame greater than 20 people means congested
Excellent tutorial, well documentation, very good thinking and presentation skill for this complication codings
when I tun my code it says "0::Net::Impl::setUpNet DNN module was not built with CUDA backend; switching to CPU" how can I fix this?
that's normal to be that way. If you have a CUDA gpu you can install Opencv CUDA to use your graphic card and it will be much faster.
on windows though, it's a pretty complex installation
PS C:\Users
itik\object_form> python object_tracking.py
Traceback (most recent call last):
File "C:\Users
itik\object_form\object_tracking.py", line 3, in
from detection import ObjectDetection
ImportError: cannot import name 'ObjectDetection' from 'detection' (C:\Users
itik\object_form\detection.py)
having these error pls help
thank you so much but i cant find video that use in this course and other code that you say it exist in links
Sir, really helpful. You are also showing how to trace and develop logic.
Bro I love you content, I would love to learn your premium courses but I cant afford them
tried to download the source code for this, but the link to my email just redirects me to an invalid page
try do it from a live ip cam not a rpi cam or a video file! i cant get it working show how its done...
Great video Sergio. You've broken it down in to manageable chunks that are easy to follow. I have a problem when trying to run this on my rPI 4 as it's complaining of -212 parsing error and an unsupported activation: mish. I guess I may just have to update my openCV but as you only made this video a few hours ago I and I've only just installed these things I should be using all the same versions as you are... Any suggestions?
Thanks again for putting the work and effort in to making these videos you are helping a lot of people get a grip of this stuff..
exactly, this only works with Opencv 4.4.0 or greater, so I guess you're using an older version.
Second thing to know, raspberry pi is too weak to handle object detection in realtime with YOLOv4, so you should integrate it with a smaller algorithm.
@@pysource-com thanks for the advice. maybe I'm hoping for too much out of the RPI.. I'm trying to make something that lets me know if someone is coming in to my gate or going out of it. one or two FPS would do probably and the video isn't being viewed or used for anything else as I have other HD cams for that .. so resolution etc isn't important.. Just an LED for going in or going out..
When I followed your tutorial on my PC it works fine.. my desk top is a little big to stick on my gate post though :-) Thanks again..
@@michaelallen185 yeh did u run it on GPU need help
@@michaelallen185 thanks buddy for help
Great tutorial. How do I run this code on my computer? I download files but I get no tracking window.
Hi, the way you teach is very cool. You make everything look so easy. Could you make a video on feature fusion in things like intent prediction and pose estimation? I know it would be advanced stuff but very helpful. Thanks.
Great video! How can i export all tracking_objects values in a txt.?
How do i get the object detection library plz help me
where is the link
Thanks for the good video. And i will be grateful if you can share a video that use this technical to calculate vehicle speed.
Hello Sergio, thnak you so much for the tutorial. I am trying to apply this to termites video, which I am recording in 9 cm petri 55 termites. I have really beginner level knowledge about coding. Can you please tell me how can I create .cfg and .weights files for termites. The only object I want to find and track is termites. I hope you can help, thank you
Thanks for your very kind and wonderful video, I really appreciate and you deserve a salary as you wish.
thanks
Excellent explanation, but i got notification cv2.error: unknown C++ exception from OpenCV code what does that mean
Object detection file and tracking both cannot be downloaded for this tutorial. Just understood the basic code. Whats the use!!
Awesome tutorial. Could you tell me what kind of setup I need (such as number of CPU cores, GPU size, Ram, Storage etc.) to run the videos smoothly?
The main component to run smoothly is an Nvidia Graphic card. It should be Nvidia GTX 1650 minimum, then a standard CPU Ryzen 5 or Intel I5 and minimum 8GB of RAM.
Also the it's important that the Opencv library should be installed with GPU.
would have been better to use one shot learning instead of comparing previous location. what if the objects leave and come back. using a rtree instead of looping through all objects would be a much faster way to compare objects
Thankyou so much for these learning videos but i am just having problems in setting up my pycharm to use all these modules at the same time so can u please make video to us your settings of your python enivronment and version and all or guide me to set it all up then i would really appreciate it.
Hello Sergio,
I have a question:
Can you give me information about the Trainingdata which you used to train the weights in the dnn folder?
How many Images?, What kind of objects in the Images, how many epochs, batchsize and so on?
in detect
return self.model.detect(frame, nmsThreshold=self.nmsThreshold, confThreshold=self.confThreshold)
error
Great tutorial, but what re the hardware requirements for this project, i just ran it verbatim on an M1 Macbook and the output is excruciatingly slow...
Hello, thank you very much for these excellent tutorials.
please can you give me the link to the video where you are traking for real projects and professional work (sorting, deep sorting). thank you once again.
Hi, can you respond me please😌
hi, this is only available on the videocourse Object Detection with opencv and deep learning that you can find on pysource.com , the section courses.
i am having problems with cv2 , after installing opencv-ython i'm always getting
import cv2
ModuleNotFoundError: No module named 'cv2'
what to do please ?
Make sure you hav visual studio installed and add C/C++ extensions in VS
pip install opencv-contrib-python
Hi, i am having a problem with
Unknown C++ exception from OpenCV code
requested the .py files but did not receive email
hello mr sagio my computer only recognize cv2 and numpy the other files it cant run
You have explianed well , thanks for your explanation
Very interesting and helpful tutorial. Thank you very much.
excellent tutorial. thank you for always sharing code for public
I tried this code, and it actually worked. We are getting output values of x and y as bounding box coordinates. My question is how to transform the bounding box coordinates to real world coordinates?
That would require mapping the area and it's much more complex than this. You also should have depth cameras or lidar sensors to get coordinates from the real world, you can't do that from a simple video.
@@pysource-com Got it, thanks a lot for your response. Is there any way to normalise these coordinates?
Hi, what GPU are you using and is the video playback running with CUDA support?
error: OpenCV(4.7.0) /io/opencv/modules/imgproc/src/drawing.cpp:1711: error: (-215:Assertion failed) 0
Hello there. Please tell me - if you increase the speed of the video by 10 times, will the counting of objects be preserved?
Does the speed of the video affect the ability to count objects?
Thank you so much, this was very helpful.
after install tracker:I don't find (EuclideancDistTraker) in tracker.please help mr
Thanks for the good video. Are you planning on a similar video on Jetson Nano? As the Python code should be the same (?), I am wondering how to utilize the Jetson Nano's hardware for such a task.
hello brothers and sisters iam struggling to make the video play on my code i have try so many time but i fail what can i do
hi Sergio! Can u help me in set only 'person' class id will be detected in this project?
I can't find the object detection file
setUpNet DNN module was not built with CUDA backend; switching to CPU. How do you resolve this issue. I have NVIDIA 1650Ti and I've downloaded the toolkit, but my video is still slow
I met the same issue. Have you solved it?
Epic, any more lessons !
Dear Sir..Can we use Yolo5 in the place of Yolov4 i mean (weight and cfg)?
Hello sergio , I have an error which is (TypeError: VideoCapture() takes no arguments)
Im followed your code but I get an error. Hope you can help me throughout this problem
hey One question: it gives an error : no module named "object_detection" even though i changed the working directory with the
provided files
Can we track multiple faces same way or do I have to use other techniques
Please I can't find the link to download those files required for this lesson, can anyone help me?
please do make a video on vehicle classification
Is there a video that explains the specific object detection file?
Just curious, could this be used to collect license plate numbers coming into or leaving a neighborhood, storing them and comparing them to an array to see if this is a frequently occurring license plate. If it isn't then store the picture and license plate date and time . It could be used as part of an electronic "Neighborhood Watch" so that if burglaries occur, the make, model, color and license plate date and time of identification will be stored as infrequent vehicle to help find the suspected burglars vehicle and help solve the burglaries. That's one use I can see for this, plus get avg speed of vehicles moving through neighborhood .
Hi, I applied yesterday with my other to get contents, but still no response. Can you pls tell me how long it takes?
So this is basically how createbackgroudsubtractor works right?
Anyone having trouble with receiving the email with the necessary files on Pysource website?
Thank you for this excellent video, it helped me a lot to understand the procedure for tracking and detecting objects.
Just a question please: I tried to implement this code but after running the program the loading of the frames is very slow, it seems that these images are displayed and not a video in real time. what is the cause of this problem please?
It's normal, if Opencv is not installed with GPU, it can process around 1 or 2 frames per second only.
You would need an Nvidia GPU and you would need to configure Opencv in order to work with that.
@@pysource-com Thank you for you answer
Hi Sergio, I am curious, how could I use this on the live feed of an Oak-d lite camera? I would like to apply it to live feed from the camera I have, and a software exists but I do not know how to use it. Thanks
I guess you solved this problem already because you asked that one year ago but maybe someone watching that video has the same question.
You can import streams via: cv.VideoCapture(0) with incrementing numbers to iterate over hardware inputs
If its a stream via ethernet you would have to use a thirdparty library to import the stream (thats more complicated but can also be done).
'pip' is not recognized as an internal or external command,
operable program or batch file.
I am getting such a message. What is this?
you need to make sure that Python is installed and executable from the windows CMD.
Instead of pip you can try running this: python -m pip install opencv-contrib-python
change it to Analog app 1 TE
اكثر من ساعة كاملة و السبب فقط هو 👦 كود بايتون 😮😢
ملفات الخوارزمية جاهزه!!!
انت تحتاج الي الكثير 😅
Another excellent tutorial 🙏
Firstly hello everyone adn Pysource. I'm Nihat and I'm extremely bad in python modules and python's itself. As you can think I couldn't install object detection in VSCODE. Can anyone help me? (I am very miserable as you can understand.)
you are the best!!! thank you!
Great work 👏👏👏👏
Excellent explanation
where to download from all those four folders?
Excellent video and wonderful tutorial! The standard module object_detection does not have "ObjectDetection" package. ImportError: cannot import name 'ObjectDetection' from 'object_detection' . Is ObjectDetection your own extension ? Thanks!
yes, it is a custom file I created. you should download that from the blog post related to this video. Links are in the description
hi, I encountered the same error and downloaded the file as you said. But it still gives the same error. Do I need to change and rewrite the code? Did you solve this problem?
i dont understand the data set can you just clear me
Can someone help me with the error "DNN module was not built with CUDA backend; switching to CPU" what's causing it, and how to handle it.
That's not an error, that's normal with the standard installation of Opencv.
Simply if you have a graphic card Nvidia GTX with 4GB+ of RAM, you can compile Opencv to use the GPU and get more than 10 times faster speed.
But this is not for beginners, it's a more advanced steps which is not important for this tutorial.
@@pysource-com Thank You for the quick reply Sir. But I'm getting 1 fps. Is there any workaround for this?
@@yidirbg93 read his reply, it's just a warning not an issue
Nice video, very interesting. I have a question: which is the best/easer way to detect objects that is not recognized by YOLO, e.g: we have a model that recognize cars, if some person/bicicle, etc is in scene, we have the notification for that.
I'm not 100% sure on this, but since YOLO produces output based on class, I'm sure there is a way you could classify bounding boxes by class, and then track in that way.
@@noahvandal6485 i have a idea now, i can performe a motion detection excludind de bb of yolo, or maybe edge detections with dimensions. My question was more about of how to detect objects that is not part of YOLO classes.
how can i download the four files?
great video, I've always struggled to run in IoT devices because low of fps, how can one optimize this for IoT environment ?.
hello. i am working on these subject for 5 years and i can say unfortunately there is not a way to run these things on raspberry pi like devices with high fps. i tried even jetson nano but if you use deep learning based approach to detect objects you have no chance. i am using dlib and opencv to detect and track faces. dlib is very good choise to detect faces accurately. and opencv's mosse tracker is really really fast. so with cpu overclocking on rasperry pi 4 i am getting 20-25 fps. but remember these devices (raspberry pi, beaglebone, odroid etc.) are not good choices to run deep learning solutions. by the way raspberry pi is the best choice in these devices. asus tinkerboard is the worst.
@@ycdcherokee What if I implement TensorFlow Lite and Edge TPU on my Raspberry Pi?
Please note that I have no knowledge of the program.
I'm trying to do simultaneously worm brain neurosimulation and object recognition an IoT device like the GoPiGo3.
th-cam.com/video/9kxty2qec4g/w-d-xo.html
Thanks for great content sir ❤️
How do I get the files used in the video please?
Thank you for sharing this
cant find a link for object detection file can you send it here?
What program is he writing this in please?
Hi I am getting this error,
cv::dnn::dnn4_v20211220::Net::Impl::setUpNet DNN module was not built with CUDA back
Same problem bro...
now what should we do??
That's normal, it's not an error, more of a warning. Opencv runs by default with CPU. If you have an Nvidia GPU you can compile it with that to speed up the detection.
But video is playing in 1FPS what should we do???
@@pysource-com yes could you please help how to compile it with GPU?
Cant find the files
Im still a little bit confused about the end. How did you increase the fps?
I have an Nvidia GPU and my Opencv is installad with GPU support.
I don't show this on the video, as it's mostly an exercise for beginners to understand about object tracking
@@pysource-com I tried to install Cuda but the nvidia driver installer fails everytime, I unchecked the Visual Studio Integration and Geforce experience but it's still no use. Im using window 11 and my card is geforce mx230. is it because my card is incompatible?
1:52 I`m using PyCharm. Am I need to install opencv on cmd or PyCharm itself?
You can do it either way, it's up to you.
but if you're using pycharm i recommend to install it already with pycharm
@@pysource-com yeah I have some libraries installed with phycharm.
Hello. Great Tutorial. Could please send me the python files for the òbject dectection you used for this tutorial as the video is not in your playlists. Thank you
Source code is free to download from video description. There is the blog post related to this video (and inside you'll find the download link)
@@pysource-com .. Thank you for your response.
Please what is your charge for consultancy on a project?
I have a project I am curently working one which I would like your input in?
Plus, where I can't see your object detection video in your opencv with python playlist. You mentioned in this video that you already did an object detection video? Could you please send me the TH-cam link for the object detection video...
Kind regards
@@babatundeoladapo3929 you can contact me here pysource.com/contact/
Please is there a code that helps me divide the path into cells and lines?
I'm not familiar with any existing codes that do that, but it's something you can certainly program from scratch with Opencv.
@@pysource-com Thank you
another question please
In one of the videos, I took one area of interest to count the cars if I wanted to do the same thing, but on two areas of the video so that the cars were counted together in the two areas, and the car numbers in the output were distributed over the two areas as you called them "roi"
@@pysource-com th-cam.com/video/O3b8lVF93jU/w-d-xo.html
Link to download the file from email is not working. Could you please check? Thanks
It should be working correctly now. Contact me here pysource.com/contact/ if still you're not able to download the files
Could you do a tomato detection from plants?
That is an interesting project that can help in the agricultural field, so I might do that in the future
You email confirmation mail is taking too long to sent
The Tracking is not up the mark its clearly evident the count is varying for many vehicles in just few Frames.
HI Sridatta, the number of the car is not the counting, but is a univocal ID associated to each car. The main goal of tracking is that to each car there is the same number ID associated that keeps following the car. The counting is a step after that that was not developed in this specific tutorial
what is the name of the application you are using sir?
The application I use to write the python code is Pycharm
I don't get this