Hello everyone.
In this video tutorial we will see how we can plot the detected objects after doing detections using
YOLO and tracking using your deep sort of algorithm.
So after doing detections using YOLO V8, we will blurred the detected objects and for object tracking
we will use the deepsort algorithm.
So for this project I will be using this GitHub repo over here so you can see this YOLO v8 Deepsort
object tracking repo.
So in this code we have already in this GitHub repo, the YOLO V8 object tracking code is already in
Deepsort Object tracking code is already integrated with the YOLO V8 algorithm.
So currently we have the object tracking code integrated with the YOLO V8 algorithm.
We only need to add the object blurring code into it.
Okay.
So we will clone this github repo into our Google colab notebook over here.
Okay.
So I have created a GitHub code Google CoLab notebook for this project which you can see in front of
your screen.
So, so currently we have object tracking integrated with the YOLO V8 algorithm.
We only need to add the object blurring code.
So when we have the bounding box around the detected objects, we will blurred the object inside the
bounding box.
So this is our target.
So first of all, I will clone this GitHub repo into our Google CoLab notebook.
Before running the script, please make sure that you have selected the runtime as GPU.
So now this GitHub repo is cloned into our Google CoLab notebook.
And you can see this over here.
Now we'll set this GitHub repo on GitHub repo as our current directory over here.
Okay.
So just ctrl v.
So now.
Now we need to install all the required libraries or the dependencies that are necessary to run this
script successfully.
So for this I will just run this cell so it will install all the required libraries that are required
to run this script.
So if you skip this step, then while doing the training validation or the prediction, you might face
this error that the Hydra library is not installed.
Matplotlib library is not installed.
Seaborn Library is not installed, so it's necessary to run this step.
So when you run this cell, you will see that requirements already satisfied, which means that some
libraries are by default installed in the Google CoLab notebook.
While some libraries are not by default installed the Google CoLab notebook.
So it will be.
So those library will be downloaded into the Google CoLab notebook like what you can say installed into
the Google CoLab notebook.
When you run this cell, like you can see that many of the libraries are not pre-installed.
And when you run this cell, many of the libraries get installed, which include requests markdown Watchdog
CD and all these libraries.
So these libraries are not installed.
So when we run this step, these libraries get installed while some libraries are by default installed
in the Google CoLab notebook.
So, uh, as we are doing.
As we are doing the detection.
So I will just navigate to the detection folder over here.
So just give me a minute.
Let's just refreshing.
Okay.
So if we see over here, just give me a minute, please.
Okay.
So as we see over here, if we go to Ultralytics, then we go to YOLO and we go to V8, then we go to
detect.
So we need to set this as our current directory because we are performing object detection and tracking.
We are not doing segmentation.
Okay.
So just set this as your current directory and just run this cell.
Okay.
So as we are implementing object tracking using Deepsort, what we do in object tracking is we assign
a unique ID to each of the detected object.
This is the only function of object tracking to assign a unique ID to each of the detected objects.
So to implement object tracking, I am using the deepsort algorithm, so we need to have the Deepsort
files into our YOLO repository.
So I'm just downloading the Deepsort files into my repository over here.
So if you see over here you can see that deepsort zip file over here.
Okay, you can.
So we need to unzip this file first.
So I'm just unzipping the deepsort file over here and you can see the unzipped file over here.
I've already explained the YOLO V8 with deepsort object tracking code, so I will not discuss the YOLO
V8 with deepsort object tracking code will only add the object planning code.
If you want to learn this.
I have made multiple video tutorials above.
In the second section you must watch this videos.
Okay, then I will download a sample video for testing from Google Drive.
Okay.
So first of all I will go to the predict.py file and I will add the object bearing code over here.
So this will be a few lines of code.
It will not be more than a few lines.
So first of all, I will just right over here go to below.
So I'm just scrolling down below and.
Now, you can see here I've added the object blurring code.
So let me explain you the code.
In this step, we are just selecting the area where we have the area of the frame where we have the
bounding boxes.
Okay, so here I'm just passing the coordinates of the bounding boxes over here.
I'm just passing the individual coordinates of the bounding boxes in the frame over here.
So I will just crop the area first where we have the bounding boxes.
Okay.
Then I will plot the area.
So then I will blurred those bounding boxes using cv2 dot blur.
And here I've just set up blur ratio over here.
Okay.
Then I will just in the complete frame of the video, I will just add the blurring, add the blur code
on the area where we have the bounding boxes.
So I'm just blurring the detected object.
So I have the bounding boxes around the detected object.
So I'm just blurring the bounding boxes.
Okay.
Of the detected objects over here and then I'm just integrating this code into my original of frame
of the video.
So that is the three lines of code which I have added.
So let's just run this cell and see what results do we get.
So just again, checking the code, if there is any thing we can fix it truly.
Okay, so that's fine.
I think I have missed one thing.
I think I need to define the import.
Cv2 is done.
Everything is done.
Let's run this script and see what results do we get.
If there is any error, we can fix it, but am hopeful that it will work fine.
So it might take some time for to execute and it will process each of the frames separately.
Okay.
So the processing on the video has started over here.
We can see it.
And okay, so the processing on the video has started.
So this will take some time.
So either it has divided the complete video into 942 frames and it is doing the processing on each of
the frames individually.
Currently 147 frames are processed and currently 172 now.
So it is doing the processing on each of the frame one by one.
So.
It will take some time and then we get the output video over here.
So as this per execution complete, I will show you the output demo video.
Okay.
So this might take some time.
Guys.
The processing on the video is done and here we have the output video.
Let me just download this video and show you what results do we get.
Okay, So let me just play this output video and see whether we are able to do the object blurring or
not, or whether we are able to do that, the detected objects or not.
So you can see that we are able to blurred all the detected objects.
You can see that where we have the bounding boxes on the those objects are being blurred.
So let me go over here so you can see that.
We are able to blur the detected objects.
Plus we have also implemented object tracking.
Like you can see that each object is being assigned a unique ID 10413211910916.
Plus we have the tracking trails as well.
So in this project we have implemented an integrated object blurring code with Deepsort object tracking,
YOLO, V8 and YOLO V8.
So that's all from this video tutorial.
I hope you have learned something from this video tutorial.
See you all in the next video.
Till then, bye bye.