Multi-Object Tracking with Ultralytics YOLO | YOLOv8 tracking

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone my name is arohi and welcome to my channel so guys in my today's video I'll show you how to perform object tracking using ultr litics package so this ultral litics package now comes within tracker that means you only need to run pip install ultral litics and your detection and tracking environment is ready right so usually how we uh work with this tracking algorithm so first of all what is tracking tracking means you detect the object in the first frame and then in the next frames you track that object using tracking algorithm okay so that means if you want to run tracking if you want to perform tracking uh usually how we do that we have first we uh install all the requirements of our object detection algorithms right and then we install the requirements of object tracking algorithm let's say if you want to use a deep sort algorithm so you will install all the libraries with which are required to run that deep sort code right so once you have the requirement then you copy your deep sort code where your object detection code is and then you make them work together okay so this is how usually we use any um tracking algorithm with object detection but using this ultral litics package now you can use tracking and detection you can have everything ready by just running pip install ultral litics okay so in my today's class I'll show you first I'll show you how to use the pre-trained object detection model YOLO V8 P train object detection model and then we will uh use the tracking part also okay so we'll detect the objects using the object detection model which is Yolo vate in this case and then we'll use the tracking algorithm with it okay to track to provide the unique ideas to the objects and guys um we we are going to perform multiobject tracking means we will track the multiple objects we are not working on a single class for tracking um if car is there we will detect car and we'll provide ID to it if person is also there in the same frame we'll detect that person as well if chair is also there uh you know present in the same frame so multiobject tracking means whatever objects are present in uh all the frames will track all those objects all right so first we will detect the objects using object detection model and then we'll run the tracker after that I'll also show you if you have a image segmentation model right so we will provide the image segmentation model and then we'll use tracker on it okay and then after that I'll show you how to perform object tracking with the YOLO V8 pause model okay and after doing all these things I'll show you how to use this YOLO V at um how to use this ultral litics package with your custom model to perform object tracking okay so let's start so this is my Jupiter notebook okay so the first thing is we are uh importing this ultral litics package okay so we are only importing this package because everything is there in this package only so there is no need to uh you know import other packages okay so here as I've told you I'm using a pre-train model so this is a YOLO V8 n. PT pre-trained model so this model is trained on Coco data set so it will detect the classes which are present in cocon datet okay and over here in this line you can see we have used model. track so track means we want to perform tracking and here we have provided the source so this is the video on which I want to perform tracking save true means it will store the results in runs folder when you'll run it okay it it will store the results in like this inside this folder okay so let's open this folder and let's see the results so here is this runs folder and this is the video on which I'm doing testing here is the runs folder let's open it and inside the detect because results are stored in detect folder open this detect and then track so I have results stored in this folder okay I've have renamed this track to this and let's open it and see the result okay give me a second so let me start the video here you can see it is detecting a portion class and yeah so this is a very short video you can see it okay guys I want to tell you one more thing here if you see here you can see it is this is a person but it is detecting it as some other class okay now how you can resolve this problem let's see that so in my next cell you can see I'm using the same model but this time while tracking I am providing this Confidence Code threshold and IOU threshold okay so over here I I just gave the source and I'm not providing these parameters okay so but now I have provided these parameters in order to get more good results so let's execute this cell this time let's see the results after that my results are stored here in this folder again I have renamed that folder to this now you will see that the class the person which is getting detected as some other class over here so that that that part has been solved okay so this is how you can do that and you can see that every every person is having some ID that means person is getting detected and tracking algorithm is providing unique IDs to them okay okay so this is how you use detection model and the tracking model now the next thing is we will use the segmentation model image segmentation model okay and then we will use the tracking model on it okay so here the segmentation model is this again this model is trained on uh Coco data set so we are providing the same video to it and uh guys one more thing to remember before moving to the next part let me tell you one thing so this is the ultral ltic YOLO V8 document and when you'll check it you will see the available trackers so right now these two trackers are available you can you this ultral litic speckers support these two trackers okay so if you want to work with deep sort or strong sort algorithm that part is not supported in uh this yet but so if you want to use strong sort or uh this deep sort algorithm then you can check this video of mine I in this video I have explained how to use um this uh deep sort with yolo it okay but if you want to perform tracking using this ultral litics package then it supports only these two trackers okay and by default this is the tracker it supports okay the default tracker is this and if you want to use by track then I'll show you how to use it okay so let's go back to the coding part here you can see in my above code so I haven't uh mentioned any tracker over here so that means it is uh picking up the uh default tracker but if you want to use the bite s then this is how you can provide this parameter like this then it will use the um this bite um bite sort okay so here the segmentation model then we are providing the source save through it will store the results in runs folder and this time I don't want to use the default tracker I want to use this by track okay so then when you'll run it let's run it it will store the results in let's see where it stores the result okay where is it here yeah so now this the results will store at this location under runs and segments now let's go to the folder back here this time let's here inside runs we have segment folder open it and this is my result and you will see that segmented person is there and you have IDs with it okay so you can see every person is having one ID okay so this is how you can use the tracko with the segmentation model after that now let's say you want to use the keypoint detection model Y8 pose okay and then you want to perform the tracking with it so again the only thing to change over here is this so the model pre-rain model we are using is uh YOLO V8 and pose this time because we want to work on the pose model and then we are tracking using this model. track method provide your input and then result store the results when you'll execute this code after that inside the run just go inside this pose and track and here you can see person IDs are there and pose is getting detected so this is how YOLO V8 uh pose you can use your keypoint detection model with the uh tracking model okay so till now I have shown you how to work with the pre-trained models okay now let's say if you have your custom model you have trained your YOLO V8 model on a object detection task which can detect custom U objects so in my case for my today's video I have a model which can detect tanks and firearms and smoke okay so now here you can see I am loading my um model Uh custom model which is in the current working directory where my Jupiter notebook is okay and I'm providing this video and we are working on it and when you'll execute it when you'll execute it the your results will be stored now let's go to detect track _ custom so guys I have renamed the folder track to this so let's open it and show you here you can see it is detecting the current uh my custom class it is also providing the ID and see you can see ID 50 and then 16 to different tank right so this is how but my custom model uh is not trained on a person class so that's why it is not detecting person it is only detecting tanks and Firearms these kind of things okay so guys this is how you can use uh ultral litics package to track and detect the custom objects right so I am sharing this um code Jupiter notebook Link in my description section you can uh try this quote and I hope this video is helpful thank you for watching
Info
Channel: Code With Aarohi
Views: 2,856
Rating: undefined out of 5
Keywords: yolov8, ultralytics, yolo, computervision, objecttracting, objectdetection
Id: Als2rO00Dx0
Channel Id: undefined
Length: 11min 37sec (697 seconds)
Published: Thu Oct 19 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.