Hello everyone.
In this video tutorial we will see how we can implement the sword object tracking with YOLO V8 in Google
CoLab.
In the last video tutorial I have already explained you that object tracking Deepsort algorithm and
the prediction script in detail.
So I will be just running the Google CoLab script.
I have already explained you the tracking prediction script in the previous lecture, so if you want
to go into the detail of the tracking script and learn about the Deepsort algorithm, please watch the
previous video tutorial.
So here I have opened the YOLO V8 Deepsort object tracking GitHub repo, so I will just go over here
and click on Google CoLab file and click on Open in New Tab.
So here the whole file will be open.
So you can see that changes will not be saved.
So you can copy it to the drive.
We'll just click over here.
So another tab will open a Google CoLab script.
So now if you make any changes in the script, it will be saved.
So just remove this.
So now if you make any changes in the script, it will be saved.
So first, please make sure that you have selected the runtime as GPU.
So if you have not selected the runtime as GPU, if you have selected that runtime as none or CPU.
So it will the script will definitely run, but the predictions on the demo video rendering the prediction
script on a demo video, the predictions per frame will be very low because it will take more time to
do the prediction.
So please make sure that you have selected the runtime as GPU.
So now we will clone the GitHub repo first.
So just run this cell.
It might take two seconds.
Okay, so just running this cell, it might take a few seconds, so please bear with me.
Thought you can see that cloning, that deep sword object tracking.
So if we see over here, we can all see this deep sword object tracking repo cloned over here.
So now we need to set this repo as our current directory.
So you can just click over here, copy path and just paste it over here and just run this cell.
Now we need to install all the dependencies or the requirements.
Basically, it's necessity to install all the dependencies because it installs all the required libraries.
Two required to run the script.
If you now don't install the dependencies, you will face error when you try to run the training or
the prediction script.
So you can see that.
If we run the dependency script, it will install all the required libraries like Tqdm Torchvision Torch.
PyTorch and other required libraries.
So it might take few seconds for this channel to run and hide the libraries.
So it installs all the libraries.
If you skip this step to run this cell, some libraries might not be installed and you will face the
issue that causing libraries is not installed when you further run the script like training or the prediction.
So now as we are performing the detection, so now we need to go to the detection folder which is inside
over here.
So just go over here.
So the detection folder contains the prediction training and validation script.
So as we only want to perform prediction over here, we are not training our model, so we are just
predicting or we can say that we are implementing detection and tracking on a PRE-TRAINED model available
on YOLO repository.
So just copy this script path and just paste it over here.
So and just run this cell so we don't need the training or validation script.
We only require the prediction script.
So as we are implementing object tracking using Deepsort.
So we will download the Deepsort files from the Google Drive on which I have placed those files.
So I will unzip the deepsort file.
So I will download a sample video for testing from Google Drive.
It might take a few seconds.
Okay, let's demo videos downloaded.
Let's run the script and see what results do we get.
So now the script is running on the demo video which we have downloaded, which is Test1 dot mp4 and
in the prediction.py script we have the algorithm tracking algorithm implemented and the detections
as well.
So if you want to learn about the tracking algorithm, deepsort tracking algorithm and all, everything
like detections are done or we are integrating Deepsort into our detections script.
So you, I recommend you to please watch the last video tutorial in which I have explained this predict.py
script from the start till the end.
So.
And so you can see that it's dull till 206 frames.
So we are total we have total 942 frames in our video and around to 78 frames have been processed.
And here we can see the detection in each of the frames.
So it might take you a minute or two further.
So to run this script.
So let's wait and see until this script completely runs so we can.
See the results as well.
So it's 484 frames.
509 523 532 546 555 564, 574, 590.
So it will take a minute or two.
So just wait and then it will display this demo video as well.
3678.
Six.
Mind your doors.
706 I'm just pausing the video as it completes.
I will be back.
So the script has done successfully and we have our output in runs detect train folder, which is over
here, runs, detect train folder, and here is our output demo video.
Let's display this output demo video into the Google CoLab.
So I, I've already set the path over here, so just run this cell.
So currently we are not focusing on the tracking and vehicle counting, so I will not explain the script
in this video tutorial.
It will be explained in the next video tutorial when I will explain you the code for the tracking and
vehicle counting.
In this video tutorial we are only focusing on integrating Deepsort object tracking in the YOLO V8.
So let's display our output demo video.
And see what results do we get?
It might take a few seconds, so I will pause the video as it completes bag.
So here is our output demo video.
Okay.
Where it is just disappeared.
Let's wait for a few seconds.
It will appear over here.
As we can download it as well.
Okay, so it's appear over here.
So we can see that detection and tracking has been implemented.
Let's download it and show you on the full screen so you can see the results as well.
So just opening it.
Up here.
Just give me a minute.
Let me shift my screen towards it.
So here is our output demo video.
You can see that we have implemented our detections and the trails we can see also and we can see the
rounded rectangle.
Here is the unique ID of each of the detected object and we can see the unique ID with the trails as
well.
You can see these trails with the bus as well.
We can see each object has a unique ID 148 157 181 and the trails as well.
So in this video tutorial we have implemented object tracking with YOLO V8 in Google CoLab.
See you all in the next video tutorial.
Till then, bye bye.