1
00:00:02,000 --> 00:00:03,000
Hello everyone.

2
00:00:03,000 --> 00:00:10,000
In this video tutorial we will see how we can integrate Deepsort object tracking with YOLO.

3
00:00:10,000 --> 00:00:12,000
So this is the complete end to end tutorial.

4
00:00:12,000 --> 00:00:17,000
I will try to explain the complete code of the prediction.py file.

5
00:00:17,000 --> 00:00:18,000
So first of all.

6
00:00:19,000 --> 00:00:20,000
It can start and open.

7
00:00:20,000 --> 00:00:23,000
PyCharm You can use any other for this project.

8
00:00:23,000 --> 00:00:28,000
You can work on Visual Studio, Spyder or using Anaconda Prompt.

9
00:00:28,000 --> 00:00:30,000
You can also implement this project.

10
00:00:30,000 --> 00:00:32,000
So it all depends on your choice.

11
00:00:32,000 --> 00:00:38,000
So here I'm creating a workspace for this project, like you can see here, repairing workspace.

12
00:00:38,000 --> 00:00:42,000
So as you upgrade workspace prepares, I will go to file.

13
00:00:44,000 --> 00:00:45,000
It can create a new pressure.

14
00:00:47,000 --> 00:00:47,000
Thank.

15
00:00:50,000 --> 00:00:55,000
And here I will choose the file object tracking YOLO V8, which is the name of the folder.

16
00:00:56,000 --> 00:00:59,000
And here I will also choose object tracking using YOLO.

17
00:00:59,000 --> 00:01:00,000
So that's fine.

18
00:01:00,000 --> 00:01:03,000
They can create this window.

19
00:01:05,000 --> 00:01:05,000
Okay.

20
00:01:05,000 --> 00:01:08,000
So we have created a new project now.

21
00:01:09,000 --> 00:01:12,000
Well, next I will go to my GitHub repo.

22
00:01:12,000 --> 00:01:14,000
I will share this link with you as well.

23
00:01:14,000 --> 00:01:20,000
So you just need to as this GitHub repo contains the code for your deep sword object tracking.

24
00:01:20,000 --> 00:01:24,000
So we will be using this code to implement this project.

25
00:01:24,000 --> 00:01:25,000
Object tracking.

26
00:01:25,000 --> 00:01:28,000
I will try to explain you the complete code as well.

27
00:01:28,000 --> 00:01:33,000
So first of all, let's run the code while we are doing predictions for a demo video.

28
00:01:33,000 --> 00:01:36,000
In that time I will explain you the complete code as well.

29
00:01:36,000 --> 00:01:39,000
So first of all, let's see the steps to run the code.

30
00:01:41,000 --> 00:01:43,000
So first we need to clone the repository.

31
00:01:43,000 --> 00:01:46,000
Just click on copy over here and let's clone this GitHub repo.

32
00:01:47,000 --> 00:01:48,000
Well.

33
00:01:49,000 --> 00:01:50,000
Yes, exactly.

34
00:01:52,000 --> 00:01:56,000
We'll just paste this over here and just click on Enter.

35
00:01:56,000 --> 00:01:59,000
So now you can see that that rapport is being blown.

36
00:01:59,000 --> 00:02:01,000
So it might take two more seconds.

37
00:02:01,000 --> 00:02:04,000
So let's wait until the rapport gets blown.

38
00:02:05,000 --> 00:02:08,000
Okay, search 67% and now soon it will be hundred percent as well.

39
00:02:12,000 --> 00:02:13,000
75%.

40
00:02:13,000 --> 00:02:14,000
82%.

41
00:02:14,000 --> 00:02:15,000
87%.

42
00:02:15,000 --> 00:02:16,000
100%.

43
00:02:16,000 --> 00:02:19,000
Okay, so now we have clone the GitHub repo over here.

44
00:02:19,000 --> 00:02:22,000
You can see that YOLO V8 Deepsort object tracking.

45
00:02:24,000 --> 00:02:26,000
Now let's look the next step we need to do.

46
00:02:26,000 --> 00:02:30,000
So in the next step, we need to go to the clone repo folder.

47
00:02:30,000 --> 00:02:32,000
So let me show you what is this?

48
00:02:32,000 --> 00:02:39,000
So currently you can see that this project Object tracking YOLO V8 is set to our current directory.

49
00:02:39,000 --> 00:02:46,000
We need to set the current directory as this clone folder name, which is YOLO v8 Deepsort object tracking

50
00:02:46,000 --> 00:02:48,000
should be the name of our current directory.

51
00:02:48,000 --> 00:02:50,000
We need to set this as current directory over.

52
00:02:50,000 --> 00:02:54,000
So just copy and this and paste what we have.

53
00:02:55,000 --> 00:02:57,000
From copied from the GitHub repo.

54
00:02:57,000 --> 00:03:02,000
So now you can see that this folder is being set as our current directory.

55
00:03:02,000 --> 00:03:02,000
Okay.

56
00:03:03,000 --> 00:03:08,000
So in the next step we need to install all the requirements or the dependencies so that we should not

57
00:03:08,000 --> 00:03:14,000
face any error when we run the prediction that this library is not installed or this library is not

58
00:03:14,000 --> 00:03:14,000
installed.

59
00:03:14,000 --> 00:03:21,000
So by running this cell, by running this one inch, install all the required libraries and dependencies.

60
00:03:21,000 --> 00:03:25,000
So just copy this from here and just paste it over here.

61
00:03:25,000 --> 00:03:31,000
So now all the required libraries or the dependencies will be installed as I have run this port previously

62
00:03:31,000 --> 00:03:31,000
as well.

63
00:03:31,000 --> 00:03:34,000
So you can see that requirements are already satisfied.

64
00:03:34,000 --> 00:03:40,000
But if you are running this port for the first time, then you need to install all the libraries.

65
00:03:40,000 --> 00:03:43,000
So the dependencies are now installed.

66
00:03:43,000 --> 00:03:45,000
So guys, as we are doing detection.

67
00:03:45,000 --> 00:03:50,000
So we need to go to that predictions folder inside this repo which is Ultralytics, YOLO.

68
00:03:50,000 --> 00:03:52,000
We hit the deck.

69
00:03:52,000 --> 00:03:57,000
So this is the detection folder which contains the training step validation script and prediction script.

70
00:03:57,000 --> 00:04:04,000
So as in this tutorial I am doing only a predicting uh, on the pre-trained model, so I will be only

71
00:04:04,000 --> 00:04:06,000
using the prediction script.

72
00:04:06,000 --> 00:04:08,000
I will not be using the training or validation step.

73
00:04:10,000 --> 00:04:14,000
So let's set this folder, detect as a word current directory.

74
00:04:14,000 --> 00:04:20,000
So just copy this from here and control V over here.

75
00:04:20,000 --> 00:04:22,000
So this has been set our current directory.

76
00:04:23,000 --> 00:04:28,000
Now we can run the prediction training or validation script where we will only be focusing on the prediction

77
00:04:28,000 --> 00:04:29,000
script.

78
00:04:29,000 --> 00:04:33,000
Next, we need to download the Deepsort files from the Google Drive.

79
00:04:33,000 --> 00:04:39,000
Or just copy this from here and just paste this over here and click on Enter.

80
00:04:40,000 --> 00:04:44,000
So you just need to go to right click over here and.

81
00:04:45,000 --> 00:04:47,000
Okay, taking time.

82
00:04:52,000 --> 00:04:53,000
We just click on download.

83
00:04:54,000 --> 00:04:57,000
So now it first it will zip and then it will download.

84
00:04:57,000 --> 00:04:58,000
It will not take much time.

85
00:04:58,000 --> 00:05:01,000
It will take around 30 seconds to 40 seconds more.

86
00:05:01,000 --> 00:05:05,000
So let's see what it will not be very time taking process.

87
00:05:05,000 --> 00:05:09,000
This the file is zipping and very soon the file has zipped.

88
00:05:09,000 --> 00:05:10,000
Now the download has started.

89
00:05:11,000 --> 00:05:11,000
Okay.

90
00:05:15,000 --> 00:05:16,000
Song.

91
00:05:18,000 --> 00:05:21,000
I could just go to the showing folder.

92
00:05:21,000 --> 00:05:25,000
Just copy this from here and just.

93
00:05:26,000 --> 00:05:28,000
This is our folder which we have created for this project.

94
00:05:28,000 --> 00:05:29,000
I will paste it over here.

95
00:05:30,000 --> 00:05:33,000
I will unzip this first extract files.

96
00:05:36,000 --> 00:05:36,000
Okay.

97
00:05:36,000 --> 00:05:39,000
So now I will get go inside this folder.

98
00:05:40,000 --> 00:05:42,000
Okay, So just copy this from here.

99
00:05:44,000 --> 00:05:53,000
And just go to your deep sort of tracking ultralytics Yolo v it detect and just paste this folder over

100
00:05:53,000 --> 00:05:54,000
here.

101
00:05:54,000 --> 00:05:59,000
This is the Deepsort folder as we are implementing object tracking using Deepsort.

102
00:05:59,000 --> 00:06:02,000
So we need to have that deepsort files.

103
00:06:03,000 --> 00:06:03,000
On our side.

104
00:06:03,000 --> 00:06:08,000
So we have just downloaded the Deepsort files which are necessary to implement object tracking using

105
00:06:08,000 --> 00:06:09,000
Deepsort.

106
00:06:09,000 --> 00:06:14,000
So if we are using a providing object tracking using SORT algorithm, we will require to have the sort

107
00:06:14,000 --> 00:06:15,000
algorithm files.

108
00:06:15,000 --> 00:06:19,000
So here as we are implementing object tracking using deepsort.

109
00:06:19,000 --> 00:06:24,000
So we need to have that deepsort files over here so you can see that Deepsort PyTorch files are over

110
00:06:24,000 --> 00:06:25,000
here.

111
00:06:25,000 --> 00:06:26,000
Okay.

112
00:06:27,000 --> 00:06:28,000
So.

113
00:06:30,000 --> 00:06:36,000
But I have completed this step which is download the Deepsort files from the Google Drive because I'm

114
00:06:36,000 --> 00:06:38,000
implementing object tracking using deepsort.

115
00:06:38,000 --> 00:06:40,000
So I need to add that deepsort files.

116
00:06:40,000 --> 00:06:45,000
So after downloading the deepsort zip file from the drive, unzip it so I've unzipped it and place into

117
00:06:45,000 --> 00:06:47,000
the YOLO detect folder.

118
00:06:47,000 --> 00:06:49,000
So I have completed this step.

119
00:06:49,000 --> 00:06:54,000
So now we need to implement tracking using on some demo video.

120
00:06:54,000 --> 00:06:56,000
So we need to have the demo video as well.

121
00:06:56,000 --> 00:07:00,000
So let's download the demo video by just popping this command.

122
00:07:00,000 --> 00:07:06,000
So I have placed the demo video on my Google Drive, so by just copying and pasting, this command will

123
00:07:06,000 --> 00:07:10,000
download the demo video from the Google Drive into the detect folder.

124
00:07:12,000 --> 00:07:16,000
Just paste this one over here and click on and drag.

125
00:07:16,000 --> 00:07:22,000
So now the demo video will be downloaded like you can see that it will be appearing here.

126
00:07:23,000 --> 00:07:25,000
Let me refresh it so you can see the test.

127
00:07:25,000 --> 00:07:28,000
Dot MP4 is the name of our demo video.

128
00:07:28,000 --> 00:07:33,000
Now let's run the script for YOLO V8 Object detection plus tracking again.

129
00:07:34,000 --> 00:07:39,000
So just copy this over here so you can see that we are using YOLO V8 model over here.

130
00:07:39,000 --> 00:07:45,000
So we have 5 to 6 different modes or sorry, five different models in YOLO, V8, YOLO V8 and is the

131
00:07:45,000 --> 00:07:47,000
smallest, but it is.

132
00:07:47,000 --> 00:07:49,000
It is fast and very less accurate.

133
00:07:49,000 --> 00:07:54,000
Yolo V8X is the largest, so yolo be eight x is more accurate, but it is very less.

134
00:07:54,000 --> 00:07:58,000
Its speed is very less as compared to the other YOLO models.

135
00:07:58,000 --> 00:08:03,000
So we are using a medium because V8 model which is around the other V8 and or you can use your the V8

136
00:08:03,000 --> 00:08:05,000
MPV as well.

137
00:08:05,000 --> 00:08:07,000
Just copy this from here.

138
00:08:08,000 --> 00:08:09,000
And.

139
00:08:10,000 --> 00:08:12,000
Is the script over here and click on Enter.

140
00:08:12,000 --> 00:08:16,000
So here we have passed the name of our demo video file.

141
00:08:16,000 --> 00:08:20,000
Here we have the model name and show is equal to true means.

142
00:08:20,000 --> 00:08:23,000
We want to check the output in the runtime.

143
00:08:23,000 --> 00:08:25,000
Like if show is not is equal to true.

144
00:08:25,000 --> 00:08:31,000
We don't write this, then we are the demo after processing the complete video or after running detection

145
00:08:31,000 --> 00:08:37,000
or tracking on the complete video, it will be saved into my required folder, but I want to see the

146
00:08:37,000 --> 00:08:41,000
output at the runtime so it and show is equal to true.

147
00:08:41,000 --> 00:08:47,000
So this script is now starting to execute, so it might take some time.

148
00:08:47,000 --> 00:08:51,000
So in the meanwhile I will try to explain with the concrete support of prediction.

149
00:08:51,000 --> 00:08:54,000
So now you can see that the script has started to run.

150
00:08:54,000 --> 00:08:59,000
So like you can see that we have a bounding box around the object.

151
00:08:59,000 --> 00:09:06,000
We have a unique ID with each of the object, like you can see two car, five truck.

152
00:09:06,000 --> 00:09:08,000
So this is detecting it wrongly.

153
00:09:08,000 --> 00:09:13,000
But if you use a larger model of your V8, so it will give more accurate results.

154
00:09:13,000 --> 00:09:17,000
So plus you can will be seeing the trails as well.

155
00:09:17,000 --> 00:09:20,000
You can see these trails like you can see this brown line over here.

156
00:09:20,000 --> 00:09:23,000
So you can see that trails and unique ID as well.

157
00:09:23,000 --> 00:09:29,000
So we have implemented object tracking, but let's see the code and see how does this all process is

158
00:09:29,000 --> 00:09:30,000
done.

159
00:09:30,000 --> 00:09:35,000
So let's see the code so you can see that we have the unique ID and the tracking trails with each of

160
00:09:35,000 --> 00:09:37,000
the detected object as well.

161
00:09:37,000 --> 00:09:39,000
So let me show you the import of the code.

162
00:09:39,000 --> 00:09:43,000
In the meanwhile, this script will be run completely.

163
00:09:43,000 --> 00:09:45,000
Then we can look the output as well.

164
00:09:45,000 --> 00:09:45,000
So.

165
00:09:48,000 --> 00:09:51,000
Guys in front of you, you can see the Predict Pi script.

166
00:09:51,000 --> 00:09:55,000
We have executed our demo video on this predict dot pi script.

167
00:09:55,000 --> 00:09:59,000
So let me explain you this whole code in a best way I can.

168
00:09:59,000 --> 00:10:02,000
So first of all, we have imported the Hydra library.

169
00:10:03,000 --> 00:10:05,000
Uh, in the next step, we have got an import torch.

170
00:10:05,000 --> 00:10:09,000
So as it is built using pi dot.

171
00:10:09,000 --> 00:10:17,000
So to perform object detection tracking, using YOLO, we need to import the module so you to use the

172
00:10:17,000 --> 00:10:18,000
PI torch library.

173
00:10:18,000 --> 00:10:20,000
We do import torch.

174
00:10:20,000 --> 00:10:28,000
So to check the version of the PI torch library, we can do print torch dot dash dash version so we

175
00:10:28,000 --> 00:10:31,000
can check the version of the torch library.

176
00:10:31,000 --> 00:10:33,000
So to.

177
00:10:34,000 --> 00:10:38,000
If you face an error in import torch like this module is not available.

178
00:10:38,000 --> 00:10:44,000
So you just need to go to the Chrome store and browser which you have just right pi torch over here

179
00:10:45,000 --> 00:10:48,000
and just go to the pi.site, click on Get Started.

180
00:10:49,000 --> 00:10:53,000
So if this module is not available, you can just go over here pi Torch build.

181
00:10:53,000 --> 00:10:58,000
So you will select the stable, build your operating system which you have, you can select, plus you

182
00:10:58,000 --> 00:11:04,000
can select PIP a language python, and if you have a GPU, you can select you deliver point six 11.7.

183
00:11:04,000 --> 00:11:08,000
But as I don't have a GPU or CPU so I will select on CPU.

184
00:11:08,000 --> 00:11:10,000
So you just need to copy this from here.

185
00:11:11,000 --> 00:11:16,000
Just click on copy and you can just paste this command in your terminal and click on Enter.

186
00:11:16,000 --> 00:11:22,000
So this will install the PI torch library or and when you do import torch, you will not again face

187
00:11:22,000 --> 00:11:23,000
this error.

188
00:11:25,000 --> 00:11:35,000
Next we have import torch dot backends, dot cuda and then so basically torch dot backends control the

189
00:11:35,000 --> 00:11:38,000
behavior of various backends that PyTorch support.

190
00:11:38,000 --> 00:11:44,000
So these backends include torch dot backends, dot dot dot backends, dot u n.

191
00:11:44,000 --> 00:11:45,000
So there are multiple backends.

192
00:11:45,000 --> 00:11:48,000
So bus just have mentioned two over here.

193
00:11:48,000 --> 00:11:51,000
Next we are importing from numpy import random.

194
00:11:51,000 --> 00:11:57,000
So numpy basically random is a module present in the numpy library.

195
00:11:57,000 --> 00:12:02,000
So this module contains the functions which are used for generating random numbers.

196
00:12:02,000 --> 00:12:09,000
So we are using this module to basically randomly generate color palettes for our different detected

197
00:12:09,000 --> 00:12:09,000
objects.

198
00:12:09,000 --> 00:12:12,000
We are not assigning a color palette to each of the objects.

199
00:12:12,000 --> 00:12:15,000
We have assigned a specific color palette to some specific object.

200
00:12:15,000 --> 00:12:22,000
But as we are running this script, our Pre-trained model is trained on coco dataset, so it contains

201
00:12:22,000 --> 00:12:28,000
around 80 classes, so it will randomly select a color palette for each of the object and sign it.

202
00:12:28,000 --> 00:12:32,000
So to randomly select a color better, we have imported the random library.

203
00:12:33,000 --> 00:12:37,000
So here we have importing some required libraries.

204
00:12:37,000 --> 00:12:38,000
Which are these?

205
00:12:38,000 --> 00:12:44,000
Next, as we are implementing object detection and tracking, we need OpenCV Python library, which

206
00:12:44,000 --> 00:12:45,000
is import cv2.

207
00:12:47,000 --> 00:12:50,000
Here we are importing the deepsort PyTorch libraries required.

208
00:12:51,000 --> 00:12:52,000
So.

209
00:12:53,000 --> 00:12:54,000
So these libraries can be.

210
00:12:55,000 --> 00:13:01,000
For example, if you order Deepsort PyTorch folder and you did go to utils and inside the.

211
00:13:02,000 --> 00:13:04,000
parser.py file.

212
00:13:04,000 --> 00:13:12,000
You will find the configuration files and if you go to deepsort or this folder, you will find the Deepsort

213
00:13:12,000 --> 00:13:14,000
folder over here which is deepsort.

214
00:13:14,000 --> 00:13:20,000
So we are importing all these required libraries of the deepsort into our main script file.

215
00:13:20,000 --> 00:13:22,000
predict.py file.

216
00:13:22,000 --> 00:13:27,000
Next we are initializing or we are importing from collections.

217
00:13:27,000 --> 00:13:32,000
So tkeo is a double ended queuing python is implementing using the module collection.

218
00:13:32,000 --> 00:13:33,000
So why?

219
00:13:33,000 --> 00:13:36,000
So you can have a question that why we need the queue.

220
00:13:36,000 --> 00:13:37,000
Why we can't use list.

221
00:13:37,000 --> 00:13:44,000
So for our list in the cases we are need a quicker abandoned operations from the both end of the container.

222
00:13:44,000 --> 00:13:50,000
So here we are using when basically we add an entities into our list.

223
00:13:50,000 --> 00:13:57,000
So when the object disappears from the frame, we need to remove the object ID from that list.

224
00:13:57,000 --> 00:13:59,000
So and and a new object appears in a frame.

225
00:13:59,000 --> 00:14:06,000
We need to add that object ID into the list so for using the queue we can have a quick add and pop operation.

226
00:14:06,000 --> 00:14:11,000
Pop is basically a removal operation, so when we assign a detect an object, we assign it a unique

227
00:14:11,000 --> 00:14:16,000
ID When the object disappears from the frame, we need to remove the ID, and when the new object appears

228
00:14:16,000 --> 00:14:23,000
in the frame, we need to get the we need to assign that ID so to assigning the ID or removing the ID

229
00:14:23,000 --> 00:14:24,000
when the object disappears.

230
00:14:24,000 --> 00:14:28,000
So this is a quick and pop operation which can be done using the queue.

231
00:14:29,000 --> 00:14:33,000
So next, if we want to convert our list into an array, we use a numpy library.

232
00:14:35,000 --> 00:14:40,000
So now we are defining the color palette because we will have a wide variety of tracks because they

233
00:14:40,000 --> 00:14:41,000
are different objects.

234
00:14:41,000 --> 00:14:47,000
So we have establish a color palette over here, so the color of the bounding boxes and the tracking

235
00:14:47,000 --> 00:14:49,000
trails will be the same for each of the objects.

236
00:14:49,000 --> 00:14:55,000
So like you can say if we have cars, so the cars bounding boxes and so on, the cars bounding boxes,

237
00:14:55,000 --> 00:14:59,000
color and train tracking previous color will be the same.

238
00:14:59,000 --> 00:15:04,000
So let me show you this by an image so that I can better explain this point.

239
00:15:07,000 --> 00:15:07,000
What?

240
00:15:07,000 --> 00:15:12,000
I've just taken this image from the output video which is displaying over here.

241
00:15:12,000 --> 00:15:20,000
So if you can see over here, let me pick up and say, no, it's one or something like, no, this is

242
00:15:20,000 --> 00:15:21,000
too much.

243
00:15:22,000 --> 00:15:25,000
That is fine, but there should be some good one.

244
00:15:26,000 --> 00:15:27,000
Okay.

245
00:15:27,000 --> 00:15:29,000
More Saturday night, girl.

246
00:15:32,000 --> 00:15:33,000
Okay, so that's good.

247
00:15:33,000 --> 00:15:36,000
So you can see that on the cars.

248
00:15:36,000 --> 00:15:40,000
You can see over here have a like a light pink color you can say.

249
00:15:40,000 --> 00:15:42,000
And the bounding box color is also pink.

250
00:15:42,000 --> 00:15:48,000
And these trails, like you can see that these trails color is also pink and the bounding box and the

251
00:15:48,000 --> 00:15:54,000
labor label color is also being over here as if you can see that there is a truck.

252
00:15:54,000 --> 00:16:00,000
So you can see that truck bounding box color is brown and this label color is also brown.

253
00:16:00,000 --> 00:16:06,000
So if we have some other object here as well, so its color will also be disciplined and dreams will

254
00:16:06,000 --> 00:16:09,000
be of that same color, which is of the bounding box color.

255
00:16:09,000 --> 00:16:13,000
So for each object like this is that truck and this is a car.

256
00:16:13,000 --> 00:16:18,000
So for each object we have the same bounding box color and the trails color.

257
00:16:18,000 --> 00:16:18,000
Okay.

258
00:16:19,000 --> 00:16:24,000
While if the for example, there is a truck, the truck will have a brown color and its trails will

259
00:16:24,000 --> 00:16:25,000
have the brown color.

260
00:16:25,000 --> 00:16:30,000
If there is a car, the car will have the pink color and its trail will have the also have the pink

261
00:16:30,000 --> 00:16:30,000
color.

262
00:16:30,000 --> 00:16:31,000
Okay.

263
00:16:32,000 --> 00:16:38,000
So here we are defining the color palette because we will have a wide variety of tracks, like we can

264
00:16:38,000 --> 00:16:41,000
have around 80 different objects in a video.

265
00:16:41,000 --> 00:16:43,000
So we want to establish a color pattern.

266
00:16:43,000 --> 00:16:48,000
So the color of the bounding boxes and the tracking frames will be same for each object which we have

267
00:16:48,000 --> 00:16:48,000
seen.

268
00:16:48,000 --> 00:16:54,000
So here we are, initializing a dictionary by the name data, okay?

269
00:16:54,000 --> 00:16:57,000
And here we have just initialized the sword as none.

270
00:16:57,000 --> 00:17:03,000
So here we are, initializing the deepsort and configuration files inside this initialize tracker function.

271
00:17:04,000 --> 00:17:11,000
So inside this track, inside this initialize tracker function, we are initializing the deepsort and

272
00:17:11,000 --> 00:17:13,000
all the required configuration files.

273
00:17:13,000 --> 00:17:18,000
Okay, so here we have a first function define x, y, x, y to x, y w.

274
00:17:18,000 --> 00:17:19,000
So.

275
00:17:20,000 --> 00:17:21,000
So basically.

276
00:17:26,000 --> 00:17:32,000
Because jewelry here gives us the predictions in the form of corner coordinates.

277
00:17:32,000 --> 00:17:38,000
But Deepsort requires the prediction in the form of center coordinates and the width and the height

278
00:17:38,000 --> 00:17:39,000
of the bounding boxes.

279
00:17:39,000 --> 00:17:42,000
Let me explain you this why we need this function.

280
00:17:42,000 --> 00:17:49,000
So, for example, let me just go over here and create a So, for example, this is a bounding box and

281
00:17:49,000 --> 00:17:51,000
here we have an object inside it.

282
00:17:51,000 --> 00:17:53,000
So the object can be anything.

283
00:17:53,000 --> 00:17:54,000
So.

284
00:17:55,000 --> 00:17:58,000
So you can say that this is our object inside the bounding box.

285
00:17:58,000 --> 00:17:59,000
So.

286
00:18:00,000 --> 00:18:03,000
This is our bounding box and this is our object inside the bounding box.

287
00:18:03,000 --> 00:18:03,000
So.

288
00:18:03,000 --> 00:18:07,000
So it will give us prediction that we right over here.

289
00:18:08,000 --> 00:18:10,000
In the form of x1 y1.

290
00:18:11,000 --> 00:18:14,000
Okay, so x1 y1 is basically the.

291
00:18:15,000 --> 00:18:21,000
Top of this is the top corner, 2X1Y1 represent this top, top left corner.

292
00:18:21,000 --> 00:18:22,000
Okay.

293
00:18:22,000 --> 00:18:29,000
So you can in the output we will get this coordinate X1Y1 over here.

294
00:18:29,000 --> 00:18:30,000
What is this?

295
00:18:30,000 --> 00:18:32,000
And this is the bottom right corner.

296
00:18:32,000 --> 00:18:36,000
This value will given by the desert, which is X2Y2.

297
00:18:37,000 --> 00:18:37,000
Okay.

298
00:18:37,000 --> 00:18:45,000
So only these two values will be provided by the model, like the the top left corner and the bottom

299
00:18:45,000 --> 00:18:47,000
right coordinate corner coordinates.

300
00:18:47,000 --> 00:18:53,000
So only these two coordinates values will be provided to us like this.

301
00:18:53,000 --> 00:18:59,000
This coordinate value will be X1Y1 in the form of and this corner value, bottom right corner value

302
00:18:59,000 --> 00:19:01,000
will be in the form of X2Y2.

303
00:19:01,000 --> 00:19:05,000
So these two values will be provided by the YOLO V8 model.

304
00:19:05,000 --> 00:19:11,000
But what Deepsort requires is Deepsort requires the prediction in the form of center coordinates.

305
00:19:11,000 --> 00:19:12,000
Deepsort wants us the.

306
00:19:12,000 --> 00:19:14,000
Let me show you that.

307
00:19:14,000 --> 00:19:21,000
So Deepsort wants us this point these coordinates so X sleeps or wants predictions in the form of x,

308
00:19:21,000 --> 00:19:27,000
y, z mean the center coordinates Deepsort only want the center coordinates and weight.

309
00:19:28,000 --> 00:19:31,000
Weight and height of the bounding box is like, this is the height.

310
00:19:33,000 --> 00:19:36,000
This is the height of the bounding box and the width of the bounding box.

311
00:19:36,000 --> 00:19:37,000
Okay.

312
00:19:37,000 --> 00:19:39,000
So it gives us.

313
00:19:39,000 --> 00:19:42,000
Let me write in a more brighter color.

314
00:19:43,000 --> 00:19:44,000
Okay, so.

315
00:19:45,000 --> 00:19:49,000
Yellowbeard gives us prediction in the form of X1Y1.

316
00:19:49,000 --> 00:19:56,000
This is the top left coordinate over here and the bottom right coordinate so it gives a prediction.

317
00:19:56,000 --> 00:19:59,000
The form of x one, y one and X2Y2.

318
00:19:59,000 --> 00:20:04,000
What Deepsort wants a prediction in the form of center coordinates like x, y, z.

319
00:20:06,000 --> 00:20:12,000
And the width and the height of the bounding boxes like width and height of the bounding boxes.

320
00:20:12,000 --> 00:20:13,000
This is the height.

321
00:20:15,000 --> 00:20:17,000
And this is the width of the bounding boxes.

322
00:20:17,000 --> 00:20:18,000
Okay.

323
00:20:19,000 --> 00:20:21,000
I know I'm writing very poorly.

324
00:20:21,000 --> 00:20:26,000
So in the next step, so after so we have created this function.

325
00:20:26,000 --> 00:20:32,000
This will convert the x1, y1 and x2 y2 coordinates like these to these coordinates.

326
00:20:32,000 --> 00:20:35,000
These coordinates and these coordinates.

327
00:20:35,000 --> 00:20:35,000
So.

328
00:20:37,000 --> 00:20:42,000
So this function will convert these two coordinates into the center, coordinates and width and height

329
00:20:42,000 --> 00:20:44,000
of the bounding boxes.

330
00:20:44,000 --> 00:20:50,000
So as you can see here in the define x one, y, x, y, z, two x, y function, we are converting

331
00:20:50,000 --> 00:20:56,000
the bounding box output received from a V8 to a format that is compatible with deepsort.

332
00:20:56,000 --> 00:21:03,000
Using this function, we convert the x1 x and y coordinates to center coordinates, which is x and y

333
00:21:03,000 --> 00:21:07,000
and return the height and width of the bounding boxes.

334
00:21:07,000 --> 00:21:10,000
So I hope you have realized this importance of this function.

335
00:21:11,000 --> 00:21:15,000
Now we have a function defined x, y, z, 2X2.

336
00:21:15,000 --> 00:21:17,000
And so.

337
00:21:17,000 --> 00:21:21,000
So this function converts the x y coordinates into another format.

338
00:21:21,000 --> 00:21:25,000
In this case, we are only looking for the Doppler width and height.

339
00:21:25,000 --> 00:21:29,000
So this function basically gives us that top left coordinates.

340
00:21:29,000 --> 00:21:30,000
Like let me show you.

341
00:21:32,000 --> 00:21:35,000
So with this second version will only give this coordinate.

342
00:21:36,000 --> 00:21:38,000
The top left coordinate, which is this one.

343
00:21:38,000 --> 00:21:41,000
So only this coordinate will be provided.

344
00:21:41,000 --> 00:21:42,000
Let me show you another color.

345
00:21:42,000 --> 00:21:43,000
So.

346
00:21:44,000 --> 00:21:46,000
Only this coordinate this one.

347
00:21:46,000 --> 00:21:48,000
This point and.

348
00:21:49,000 --> 00:21:51,000
And the width and height of the bounding boxes.

349
00:21:51,000 --> 00:21:55,000
Okay, so this will give us a top left coordinate and width and height of the bounding boxes.

350
00:21:55,000 --> 00:22:00,000
This function will provide but liquid as we are not using this function in this code so you can just

351
00:22:00,000 --> 00:22:01,000
skip this.

352
00:22:01,000 --> 00:22:05,000
So next we are computing colors for the labels.

353
00:22:05,000 --> 00:22:08,000
So here we have defined some colors for the specific labels.

354
00:22:08,000 --> 00:22:12,000
For example, there is a label of person which is zero label.

355
00:22:12,000 --> 00:22:16,000
If we have object that is zero, it will means it represents a class of person.

356
00:22:16,000 --> 00:22:23,000
So if we have a label zero, then we will assign this color palette to the bounding boxes and that fills

357
00:22:23,000 --> 00:22:23,000
or as well.

358
00:22:23,000 --> 00:22:25,000
So these are the trails.

359
00:22:25,000 --> 00:22:28,000
When I'm talking about trails, I'm talking about these lines.

360
00:22:28,000 --> 00:22:29,000
Okay.

361
00:22:29,000 --> 00:22:30,000
These lines.

362
00:22:31,000 --> 00:22:31,000
These lines.

363
00:22:31,000 --> 00:22:32,000
You can see over here.

364
00:22:32,000 --> 00:22:33,000
These lines.

365
00:22:33,000 --> 00:22:34,000
Okay.

366
00:22:34,000 --> 00:22:42,000
So if we have a person object of class, so we'll assign this color to bounding boxes and the trails.

367
00:22:42,000 --> 00:22:44,000
If we have a car, we will assign this color.

368
00:22:44,000 --> 00:22:47,000
So this is light pink color which is being currently being assigned.

369
00:22:47,000 --> 00:22:48,000
This is light in color.

370
00:22:49,000 --> 00:22:53,000
And if the your motorbike is color will decide if you have a bus, this color will be a.

371
00:22:54,000 --> 00:23:01,000
So if the detected object does not belongs to any of these labels or class, then it will randomly select

372
00:23:01,000 --> 00:23:08,000
the color palette and it will show if the detected object is not from any of this class, then it will

373
00:23:08,000 --> 00:23:12,000
randomly select a color and it will assign a in.

374
00:23:12,000 --> 00:23:14,000
The output will get the attribute of that color.

375
00:23:14,000 --> 00:23:15,000
Okay, so.

376
00:23:16,000 --> 00:23:21,000
Next we have our draw our border function in the draw border function.

377
00:23:25,000 --> 00:23:27,000
In draw dash border function.

378
00:23:27,000 --> 00:23:31,000
We have written the script to create a rounded rectangle for the label.

379
00:23:31,000 --> 00:23:32,000
Let me show you.

380
00:23:32,000 --> 00:23:33,000
So.

381
00:23:34,000 --> 00:23:41,000
So you can see over here, this is a rounded rectangle in which contains the 86 cent card.

382
00:23:41,000 --> 00:23:45,000
So to create this rounded rectangle is rounded rectangle only.

383
00:23:46,000 --> 00:23:49,000
I have written the script for the Draw Dash border.

384
00:23:49,000 --> 00:23:55,000
So this draw dash border contains a square with the help of which we can create this rounded rectangle.

385
00:23:55,000 --> 00:23:59,000
Okay, so next we have the dashboard function.

386
00:24:00,000 --> 00:24:04,000
So in the box function we have the cv2 dot rectangle.

387
00:24:04,000 --> 00:24:11,000
So Cv2 dot rectangles create a bounding box like this bounding box around the detected objects like

388
00:24:11,000 --> 00:24:13,000
you can see here as well.

389
00:24:13,000 --> 00:24:16,000
So you can see here as well.

390
00:24:16,000 --> 00:24:16,000
So.

391
00:24:17,000 --> 00:24:19,000
Uh, see, we're using cv2 dot rectangle.

392
00:24:19,000 --> 00:24:23,000
We can create a bounding box around the detected object.

393
00:24:23,000 --> 00:24:23,000
Okay.

394
00:24:24,000 --> 00:24:27,000
And C1 C2 contain the center coordinates.

395
00:24:27,000 --> 00:24:28,000
Okay.

396
00:24:28,000 --> 00:24:33,000
So in the next step, we are calling the draw dash border function over here.

397
00:24:33,000 --> 00:24:36,000
So this is the draw dash border function which I have explained previously.

398
00:24:36,000 --> 00:24:43,000
So now we are calling draw dash border function over here to create a rounded rectangle like this rounded

399
00:24:43,000 --> 00:24:43,000
rectangle.

400
00:24:43,000 --> 00:24:45,000
And this one I've already explained.

401
00:24:45,000 --> 00:24:50,000
And using cv2 dot put text using this Cv2 dot put text.

402
00:24:50,000 --> 00:24:56,000
We are adding the text text in this drawer dash rectangle which is 86 and car.

403
00:24:57,000 --> 00:24:59,000
We'll draw this border.

404
00:24:59,000 --> 00:25:03,000
We create a rounded rectangle like this one.

405
00:25:04,000 --> 00:25:06,000
And using cv2 dot put text.

406
00:25:06,000 --> 00:25:12,000
We add this text like identity ID number or unique ID number of each object and the object name.

407
00:25:13,000 --> 00:25:15,000
Okay, so this is on.

408
00:25:15,000 --> 00:25:19,000
Now we have a draw boxes function in draw box six function.

409
00:25:19,000 --> 00:25:21,000
I am calling the dash box function.

410
00:25:21,000 --> 00:25:22,000
Let me show you its called.

411
00:25:23,000 --> 00:25:24,000
So.

412
00:25:26,000 --> 00:25:28,000
And let me see where it is called.

413
00:25:36,000 --> 00:25:36,000
For him.

414
00:25:36,000 --> 00:25:40,000
The draw dice boxes function we have called the box function.

415
00:25:40,000 --> 00:25:48,000
So the box function will add the rectangle around the y function.

416
00:25:48,000 --> 00:25:53,000
Box function will create this rectangle around the detected object like this rectangle square rectangle

417
00:25:53,000 --> 00:25:59,000
and also add the this rounded rectangle as well and put the text into this as well.

418
00:25:59,000 --> 00:26:02,000
So box function do thing three things.

419
00:26:02,000 --> 00:26:04,000
First, it create a rounded rectangle.

420
00:26:04,000 --> 00:26:08,000
It creates a rectangle around the detected object, which is a square rectangle.

421
00:26:08,000 --> 00:26:14,000
Second, it adds a it creates a rounded rectangle using draw dash border function because we are calling

422
00:26:14,000 --> 00:26:20,000
draw dash border function inside the dash box function plus it assigns a unique ID and the label name.

423
00:26:20,000 --> 00:26:22,000
Okay, so.

424
00:26:24,000 --> 00:26:25,000
Let's go up.

425
00:26:25,000 --> 00:26:31,000
So to draw the bounding boxes around the detected object, assigning unique IDs to each detected object,

426
00:26:31,000 --> 00:26:34,000
assigning labels will be done using the.

427
00:26:35,000 --> 00:26:40,000
The dash box function which we have created over here.

428
00:26:40,000 --> 00:26:46,000
And we are just calling this dash function function in this drawer, dash boxes function and this drawer

429
00:26:46,000 --> 00:26:47,000
dash drawing.

430
00:26:47,000 --> 00:26:50,000
Drawing will also draw the trails for tracking.

431
00:26:50,000 --> 00:26:56,000
So drawing the trails for tracking script will be written in this over here, like this is the trails.

432
00:26:56,000 --> 00:26:57,000
These are the trails.

433
00:26:57,000 --> 00:26:59,000
These are the trails I'm talking about.

434
00:27:00,000 --> 00:27:01,000
Okay.

435
00:27:01,000 --> 00:27:07,000
So as we are doing detection frame by frame, so here I am checking the height and width of the current

436
00:27:07,000 --> 00:27:07,000
frame.

437
00:27:07,000 --> 00:27:08,000
Okay.

438
00:27:08,000 --> 00:27:11,000
So here I'm just checking the height and width of the current frame.

439
00:27:11,000 --> 00:27:12,000
Okay.

440
00:27:12,000 --> 00:27:17,000
So we will store the unique IDs of the detected object until the object is in the frame.

441
00:27:17,000 --> 00:27:19,000
Okay, so let me explain this.

442
00:27:19,000 --> 00:27:25,000
You can see that each object is being assigned a unique ID 87, 53, 67, 68.

443
00:27:25,000 --> 00:27:28,000
So all these IDs, unique IDs.

444
00:27:31,000 --> 00:27:34,000
Basically all these unique IDs will be stored in a list.

445
00:27:34,000 --> 00:27:38,000
Okay, So these will be stored in that list which we have created.

446
00:27:38,000 --> 00:27:43,000
Like we have told you in the start, that using we can add and remove an item from the list.

447
00:27:44,000 --> 00:27:46,000
Okay, so these will be stored in the list.

448
00:27:46,000 --> 00:27:51,000
So until this specific object is in the frame, the ID will be assigned to that object.

449
00:27:51,000 --> 00:27:56,000
When the object is disappears, for example, the yellow card is in the current frame, but after few

450
00:27:56,000 --> 00:28:00,000
frames, the yellow card disappears from the frame.

451
00:28:00,000 --> 00:28:06,000
Okay, so we will remove As the object disappears from the frame, we will remove the unique ID of that

452
00:28:06,000 --> 00:28:09,000
object from the list and will also end.

453
00:28:09,000 --> 00:28:14,000
For example, the yellow card disappears and the black card enters into that frame in our frame.

454
00:28:14,000 --> 00:28:21,000
So we will assign the unique ID to the new object and we will also save the new unique ID of the new

455
00:28:21,000 --> 00:28:22,000
object appearing in the frame.

456
00:28:22,000 --> 00:28:25,000
Okay, so here we have written a script.

457
00:28:25,000 --> 00:28:29,000
So if the object disappears from the frame, we will remove that object.

458
00:28:29,000 --> 00:28:31,000
Unique id.

459
00:28:31,000 --> 00:28:31,000
Okay.

460
00:28:31,000 --> 00:28:38,000
Using dot pop key, we remove the ID of the object from the list if the object is no more in the frame.

461
00:28:39,000 --> 00:28:39,000
Okay.

462
00:28:39,000 --> 00:28:40,000
So next we will.

463
00:28:43,000 --> 00:28:46,000
Well, now we will loop through the bounding boxes one by one.

464
00:28:46,000 --> 00:28:51,000
So here we have the on the paw coordinates for each of the bounding box.

465
00:28:52,000 --> 00:29:00,000
So x one and y one represents the top left corner and X2 and Y2 represent the bottom right corner of

466
00:29:00,000 --> 00:29:01,000
the bounding box.

467
00:29:01,000 --> 00:29:02,000
Let me show you.

468
00:29:03,000 --> 00:29:04,000
I have ordered his plane.

469
00:29:04,000 --> 00:29:06,000
But let me explain this as well.

470
00:29:07,000 --> 00:29:14,000
So if we just clean this up it so that I can in a better position to explain this.

471
00:29:14,000 --> 00:29:15,000
Okay.

472
00:29:15,000 --> 00:29:15,000
So.

473
00:29:15,000 --> 00:29:16,000
Okay.

474
00:29:16,000 --> 00:29:16,000
Okay.

475
00:29:16,000 --> 00:29:18,000
So let me show you.

476
00:29:19,000 --> 00:29:24,000
So we have you can see that multiple bounding boxes over here like one, two, three, four, five,

477
00:29:24,000 --> 00:29:26,000
six, seven, eight, nine.

478
00:29:26,000 --> 00:29:29,000
Okay, so one thing is.

479
00:29:32,000 --> 00:29:33,000
This is basically x one.

480
00:29:33,000 --> 00:29:34,000
Y one.

481
00:29:35,000 --> 00:29:40,000
It is the top left corner and this is the bottom right corner and this represents x2 y2.

482
00:29:40,000 --> 00:29:41,000
Okay.

483
00:29:41,000 --> 00:29:44,000
So for each of the bounding box over here.

484
00:29:45,000 --> 00:29:46,000
Like this one.

485
00:29:46,000 --> 00:29:47,000
This one.

486
00:29:47,000 --> 00:29:47,000
This one.

487
00:29:48,000 --> 00:29:48,000
Okay.

488
00:29:48,000 --> 00:29:53,000
Like for each of the bounding box over here, we have the four coordinates for each of the bounding

489
00:29:53,000 --> 00:29:53,000
box.

490
00:29:55,000 --> 00:29:58,000
Which is x1, y1, x2 and Y2.

491
00:29:58,000 --> 00:30:04,000
Okay, so next we need to find the center of the bottom edge of the bounding box.

492
00:30:05,000 --> 00:30:06,000
So let me show you.

493
00:30:06,000 --> 00:30:10,000
So in the next step, basically, this is the center of the bottom edge of the bounding box.

494
00:30:10,000 --> 00:30:14,000
Like this is the center of the bottom edge of the bounding box.

495
00:30:14,000 --> 00:30:18,000
We need to find the center because we will draw trails from the center.

496
00:30:18,000 --> 00:30:20,000
You can see that these are the trails.

497
00:30:20,000 --> 00:30:21,000
So we need to find the center.

498
00:30:22,000 --> 00:30:26,000
So here we have written the code to find the center of the bottom edge of the bounding box.

499
00:30:28,000 --> 00:30:29,000
Next.

500
00:30:29,000 --> 00:30:29,000
We will.

501
00:30:30,000 --> 00:30:33,000
We need to have a unique ID for each of the project.

502
00:30:33,000 --> 00:30:39,000
So using this script, we'll get a unique ID for each of the detected object.

503
00:30:41,000 --> 00:30:45,000
Okay, so next, we can see if the new object appears in the frame.

504
00:30:45,000 --> 00:30:51,000
So here we have assigned a new ID if the a new objects appear in the frame.

505
00:30:51,000 --> 00:30:57,000
Okay, so now we will create a new buffer or a new list which has the maximum length 64.

506
00:30:57,000 --> 00:30:59,000
So if so, let me show you.

507
00:30:59,000 --> 00:31:03,000
So we have we have created a list which maximum length is 64.

508
00:31:03,000 --> 00:31:08,000
So what we will do here is basically you can see this.

509
00:31:08,000 --> 00:31:10,000
We have drawn the trails over here.

510
00:31:10,000 --> 00:31:18,000
So we have saved this center points basically after getting the center point of this, like after calculating

511
00:31:18,000 --> 00:31:20,000
the bottom center.

512
00:31:20,000 --> 00:31:22,000
Let me try to explain this better way.

513
00:31:24,000 --> 00:31:28,000
So after finding the center of the bottom edge of the bounding box.

514
00:31:28,000 --> 00:31:35,000
So after I find the center of the bottom edge of the bounding box, I will save all the center points

515
00:31:35,000 --> 00:31:36,000
of each of the frame.

516
00:31:36,000 --> 00:31:38,000
Like there are 100 frames in a video.

517
00:31:38,000 --> 00:31:45,000
I will save this center of the bottom edge of the bounding box of each of the each of sorry, of the

518
00:31:45,000 --> 00:31:49,000
bottom edge of the bounding box of each of the frame in a list.

519
00:31:49,000 --> 00:31:57,000
So basically the center of the bottom edge of the bounding box of all the hundred frames in which the

520
00:31:57,000 --> 00:32:00,000
object is appearing is saved in a list.

521
00:32:00,000 --> 00:32:02,000
Okay, which maximum length is 64.

522
00:32:02,000 --> 00:32:10,000
So if a 65 fifth of the object appears, element appears it will remove the first and it will add the

523
00:32:10,000 --> 00:32:11,000
65 into it.

524
00:32:11,000 --> 00:32:12,000
So.

525
00:32:13,000 --> 00:32:18,000
As the new elements appear that all the previous elements will be removed.

526
00:32:18,000 --> 00:32:23,000
Okay, so if we set this line to 128 so one thing will happen.

527
00:32:23,000 --> 00:32:32,000
This trains will go further long because after we save the center coordinates like the bottom edge,

528
00:32:32,000 --> 00:32:40,000
bottom of the the bounding box coordinate and we draw the trails using these coordinates, which we

529
00:32:40,000 --> 00:32:40,000
have saved.

530
00:32:40,000 --> 00:32:42,000
Okay, so.

531
00:32:44,000 --> 00:32:49,000
After saving the center of the of the module, the bounding box coordinates, we draw trees, which

532
00:32:49,000 --> 00:32:50,000
maximum length is 64.

533
00:32:50,000 --> 00:32:55,000
So if we change the maximum length to 128, this change length will go further wrong.

534
00:32:55,000 --> 00:33:00,000
Okay, so now we are setting a unique color for each bounding box and rounding rectangles which could

535
00:33:00,000 --> 00:33:01,000
be in the labor.

536
00:33:02,000 --> 00:33:08,000
Okay, so next we have the object id object id contains the ID for the each of the object, like for

537
00:33:08,000 --> 00:33:10,000
the person, the object ID will be zero.

538
00:33:10,000 --> 00:33:12,000
So when we write names, zero.

539
00:33:12,000 --> 00:33:15,000
So in the names we have the names for on the object.

540
00:33:15,000 --> 00:33:18,000
So if we object, ID is zero over here.

541
00:33:18,000 --> 00:33:20,000
So if there is a zero over here.

542
00:33:20,000 --> 00:33:22,000
So it means that the object name is person.

543
00:33:22,000 --> 00:33:25,000
If there is a one, then it means there is a car or a bus.

544
00:33:25,000 --> 00:33:26,000
Okay.

545
00:33:26,000 --> 00:33:29,000
So now here we are just putting the labels in a required format.

546
00:33:31,000 --> 00:33:38,000
So you can see that we are appending the center points of the bottom edge of the bounding box like we

547
00:33:38,000 --> 00:33:45,000
are appending these center coordinates into our data dequeue list so that a data list is maximum.

548
00:33:45,000 --> 00:33:46,000
That is 64.

549
00:33:46,000 --> 00:33:46,000
So.

550
00:33:47,000 --> 00:33:51,000
Using this center coordinates would be saved in the data list.

551
00:33:51,000 --> 00:33:54,000
And using these coordinates, we will draw the trails.

552
00:33:54,000 --> 00:33:59,000
Okay, so now we are just using the foot box function to create a rounded rectangle.

553
00:34:00,000 --> 00:34:06,000
To create this rounded rectangle and to add the text and to draw this rounded rectangle as well.

554
00:34:06,000 --> 00:34:07,000
To create this rectangle.

555
00:34:07,000 --> 00:34:08,000
Sorry, this is not the rounded.

556
00:34:08,000 --> 00:34:15,000
We are using this box function to create this rectangle and this rounded rectangle and to put that text

557
00:34:15,000 --> 00:34:17,000
over here as well, which is ID and label.

558
00:34:19,000 --> 00:34:23,000
Okay, so now here we are, just drawing the trails.

559
00:34:23,000 --> 00:34:27,000
You can you can see that we are drawing the trails using Cv2 dot nine.

560
00:34:27,000 --> 00:34:33,000
So it basically loops through the data data center points and draw a line between the current and last

561
00:34:33,000 --> 00:34:33,000
point.

562
00:34:33,000 --> 00:34:37,000
So if, if the lattice maximum length is 64.

563
00:34:38,000 --> 00:34:38,000
Okay.

564
00:34:38,000 --> 00:34:46,000
So we have saved a 64 and the center points in the list, if the net is 64, we saved us 64 center points

565
00:34:46,000 --> 00:34:54,000
in the list is 64 and we have the length of 64 trails of 64 center point if we change the maximum length

566
00:34:54,000 --> 00:34:55,000
to 128.

567
00:34:55,000 --> 00:34:56,000
Okay.

568
00:34:56,000 --> 00:34:59,000
So this trails that will go even further.

569
00:34:59,000 --> 00:35:00,000
Okay.

570
00:35:00,000 --> 00:35:07,000
So in this way, all this process is implemented here, we will draw the line of the trails in next.

571
00:35:07,000 --> 00:35:08,000
This is all the code for the.

572
00:35:10,000 --> 00:35:12,000
If we go further.

573
00:35:13,000 --> 00:35:20,000
So what we are doing here, we are just looping over all the detections because it gives us the corner

574
00:35:20,000 --> 00:35:26,000
coordinates like x1, Y1, x2 and Y2, but Deepsort requires the center coordinates and the height and

575
00:35:26,000 --> 00:35:27,000
the width.

576
00:35:27,000 --> 00:35:32,000
So here we are, just converting the corner coordinates like this.

577
00:35:32,000 --> 00:35:33,000
Let me show you.

578
00:35:33,000 --> 00:35:38,000
Here we are converting the coordinate coordinates X1Y1X2Y2.

579
00:35:39,000 --> 00:35:40,000
Those center coordinates.

580
00:35:40,000 --> 00:35:46,000
So we are just want to get the center coordinates and the width and the height of the bounding boxes.

581
00:35:47,000 --> 00:35:49,000
Okay, so.

582
00:35:50,000 --> 00:35:55,000
Using this function, we just pass the coordinate coordinates and get the center coordinates, X, y,

583
00:35:55,000 --> 00:35:58,000
z and width and height of the bounding box.

584
00:35:59,000 --> 00:36:05,000
So now we are using a deepsort update function that is, and this function is called the update function.

585
00:36:05,000 --> 00:36:10,000
The bot takes all the texture and just add the identities because he like you wallaby it will do the

586
00:36:10,000 --> 00:36:11,000
detections.

587
00:36:12,000 --> 00:36:17,000
Deepsort will only assign a unique ID to each of the object and draw the trails.

588
00:36:18,000 --> 00:36:22,000
So dinshaw short, just assign unique ID so these IDs are not incremental.

589
00:36:22,000 --> 00:36:24,000
So what does it means that.

590
00:36:25,000 --> 00:36:31,000
Like you can see that 87, 68, 53, 67 like it is not 87, 88, 89, 90.

591
00:36:31,000 --> 00:36:38,000
It assigns a ID randomly so it can assign a one ID to this object to 1011.

592
00:36:38,000 --> 00:36:40,000
So it is not incremental form.

593
00:36:41,000 --> 00:36:41,000
Okay.

594
00:36:42,000 --> 00:36:44,000
Well, I think this is all from the code.

595
00:36:44,000 --> 00:36:46,000
I hope you have understood this.

596
00:36:46,000 --> 00:36:51,000
In the meanwhile, our script has been dropped, so let me show the output demo video which will be

597
00:36:51,000 --> 00:36:51,000
saved.

598
00:36:52,000 --> 00:36:54,000
Um, in this folder.

599
00:36:54,000 --> 00:36:56,000
Let me go to this folder.

600
00:37:00,000 --> 00:37:02,000
But what was the name of the project?

601
00:37:02,000 --> 00:37:02,000
I think.

602
00:37:04,000 --> 00:37:05,000
Rectangularly eared.

603
00:37:05,000 --> 00:37:09,000
And then we will go to your deepsort alternatives.

604
00:37:09,000 --> 00:37:10,000
Yolo.

605
00:37:11,000 --> 00:37:12,000
We ate.

606
00:37:12,000 --> 00:37:16,000
It runs with the tree.

607
00:37:16,000 --> 00:37:18,000
And here is our output video.

608
00:37:18,000 --> 00:37:24,000
Let's see the results so you can see that we have a unique ID with each of the object.

609
00:37:24,000 --> 00:37:25,000
Thus we have a tracking trace.

610
00:37:26,000 --> 00:37:28,000
We have detecting the object.

611
00:37:28,000 --> 00:37:29,000
We are able to track the object.

612
00:37:30,000 --> 00:37:32,000
Well, the model is working quite fine.

613
00:37:32,000 --> 00:37:36,000
We are able to detect, track and assign a unique ID to each of the object.

614
00:37:37,000 --> 00:37:39,000
So this is all from this video tutorial.

615
00:37:39,000 --> 00:37:41,000
I hope you have learned a lot from it.

616
00:37:41,000 --> 00:37:43,000
See you all in the next video tutorial.

617
00:37:43,000 --> 00:37:44,000
Till then, bye bye.

