1
00:00:02,640 --> 00:00:09,810
In this video tutorial, we will learn how we can create each of the detected object using Deepsort

2
00:00:09,840 --> 00:00:11,400
object tracking algorithm.

3
00:00:11,970 --> 00:00:18,990
We will be integrating Yolo v9 with Deepsort object tracking algorithm, so we will use YOLO v9 to detect

4
00:00:18,990 --> 00:00:22,410
objects in image video or in a live webcam feed.

5
00:00:22,860 --> 00:00:30,060
And then we will be using Deepsort object tracking algorithm to track each of the detected object until

6
00:00:30,060 --> 00:00:34,890
that object remains in the frame of a video or in a live webcam feed.

7
00:00:35,280 --> 00:00:37,200
So what we do in object tracking?

8
00:00:37,500 --> 00:00:42,480
In object tracking, we basically assign a unique ID to each of the detected object.

9
00:00:42,480 --> 00:00:48,600
And then using that unique ID, we track that object until that object remains enough.

10
00:00:49,170 --> 00:00:54,450
Uh, in remains in, uh, in the frame of a video or in a live webcam feed.

11
00:00:54,690 --> 00:00:59,850
So using that unique ID that we assigned to each of the detected object, we then track the object.

12
00:00:59,850 --> 00:01:05,640
We can also draw trails, follow the path that check the path the object is following.

13
00:01:05,820 --> 00:01:07,890
So that's all we are going to learn.

14
00:01:07,890 --> 00:01:12,420
In this tutorial we will be integrating YOLO v9 with Deepsort object tracking algorithm.

15
00:01:12,420 --> 00:01:19,110
You all know your V9 was released last month on 21st February 2024, which is the state of the art object

16
00:01:19,320 --> 00:01:25,200
detection algorithm and YOLO be nine outperforms all the previous object detection algorithms as well.

17
00:01:25,200 --> 00:01:29,910
While Deepsort algorithm is the state of the art object tracking algorithm.

18
00:01:29,910 --> 00:01:35,070
So by combining the state of the art object track detection algorithm with object tracking algorithm,

19
00:01:35,070 --> 00:01:38,610
we will be doing object detection last object tracking.

20
00:01:38,610 --> 00:01:40,860
So that's what we are going to learn.

21
00:01:41,720 --> 00:01:42,860
In this tutorial.

22
00:01:42,860 --> 00:01:46,670
Thus, we will also see if the object gets blurred or hidden.

23
00:01:46,700 --> 00:01:51,620
We will also be tracking that object and that object unique ID will remain the same.

24
00:01:52,100 --> 00:01:54,200
Okay, so let's get started.

25
00:01:54,200 --> 00:02:00,560
So over here you can see in my jump I have opened PyCharm over here and I have Python 3.10 installed.

26
00:02:00,560 --> 00:02:02,150
You can see over here.

27
00:02:02,150 --> 00:02:07,100
Plus I have just created a project over here by the name of init Deepsort.

28
00:02:07,520 --> 00:02:10,100
So I have created this project in my app directory.

29
00:02:10,100 --> 00:02:14,510
So in the same way you can create this any project in any of your directory.

30
00:02:14,510 --> 00:02:16,460
Plus you can also use Visual Studio.

31
00:02:16,460 --> 00:02:17,690
I'm using PyCharm.

32
00:02:17,690 --> 00:02:20,120
You can also use Visual Studio as well.

33
00:02:21,590 --> 00:02:23,930
Between the first step, we'll go step by step.

34
00:02:23,930 --> 00:02:29,660
So if you just see this note while I've written all the steps, so which I will be pointing.

35
00:02:29,660 --> 00:02:32,120
So first we need to clone the repo.

36
00:02:32,690 --> 00:02:34,790
So I will just open the browser over here.

37
00:02:35,450 --> 00:02:35,630
It.

38
00:02:37,820 --> 00:02:40,520
And I will just go over here and.

39
00:02:42,010 --> 00:02:45,100
I will just write your lovin line GitHub over here.

40
00:02:46,410 --> 00:02:46,710
Lingua.

41
00:02:46,710 --> 00:02:47,520
Volume nine.

42
00:02:47,550 --> 00:02:48,270
Get up.

43
00:02:53,890 --> 00:02:57,340
So you'll just search for this guadalmina and get up over here.

44
00:02:57,340 --> 00:03:00,310
And I will just open this post link from here.

45
00:03:01,240 --> 00:03:04,300
Okay, so this is the Yolo v9 official GitHub repo.

46
00:03:04,330 --> 00:03:06,100
It has around 7000 stars.

47
00:03:06,100 --> 00:03:12,370
So I will just, uh, clone this complete, uh, repo into my, uh, PyCharm directory.

48
00:03:12,550 --> 00:03:14,830
So I will just click copy this link from here.

49
00:03:14,830 --> 00:03:17,470
Then I will just go to the PyCharm over here.

50
00:03:17,710 --> 00:03:19,870
And then I will just here.

51
00:03:20,500 --> 00:03:22,330
And then I will just write git clone.

52
00:03:22,330 --> 00:03:24,580
And here I will just add the repo link.

53
00:03:24,580 --> 00:03:29,140
So now it will clone this complete repo into my local directory over here.

54
00:03:29,140 --> 00:03:30,790
And you will find this okay.

55
00:03:30,790 --> 00:03:31,750
So it's done now.

56
00:03:32,320 --> 00:03:36,820
So if I just refresh this so you can find this complete Golovnin repo over here.

57
00:03:38,440 --> 00:03:43,660
So now in the step number two I will just start this uh yolo benign repo, uh, which I have cloned

58
00:03:43,660 --> 00:03:44,950
as my current directory.

59
00:03:44,950 --> 00:03:48,430
So I will write CD yolo VI over here okay.

60
00:03:50,920 --> 00:03:51,310
Bernard.

61
00:03:51,310 --> 00:03:52,510
This is being.

62
00:03:55,060 --> 00:04:01,360
So now if I just open the requirements.txt file, the requirements.txt file you can find, I have the,

63
00:04:01,360 --> 00:04:07,390
they have listed all the required packages that are required uh, to run the repo successfully.

64
00:04:07,600 --> 00:04:08,140
Okay.

65
00:04:08,140 --> 00:04:10,240
So okay.

66
00:04:10,240 --> 00:04:14,350
So I will just uh, as we will be integrating object tracking using Deepsort algorithm.

67
00:04:14,350 --> 00:04:17,980
So we need to add few more uh, packages as well.

68
00:04:17,980 --> 00:04:24,220
So which is you can add it and plus I will see if the numpy package is over here.

69
00:04:24,280 --> 00:04:28,600
So okay so I will require numpy package.

70
00:04:31,660 --> 00:04:32,560
Less than.

71
00:04:34,080 --> 00:04:35,460
1.24.

72
00:04:35,730 --> 00:04:37,380
And so we will be getting an error.

73
00:04:37,380 --> 00:04:38,490
So it's always factored.

74
00:04:39,180 --> 00:04:47,790
So this and we also required g down package because we will be uh installing demo videos or deepsort

75
00:04:47,790 --> 00:04:50,640
files from the drive into the tracker into this PyCharm.

76
00:04:50,850 --> 00:04:52,470
Uh ID okay.

77
00:04:52,470 --> 00:04:58,350
So now in the step number two, what is install all the required packages okay.

78
00:04:58,350 --> 00:05:01,530
So we will be installing all the required packages over here.

79
00:05:06,250 --> 00:05:09,730
Well, now to install all these required packages I will simply write over here.

80
00:05:09,760 --> 00:05:15,370
Pip install minus r requirements dot txt.

81
00:05:15,370 --> 00:05:20,740
So we don't need to install all these packages one by one if we just write requirements dot txt.

82
00:05:20,770 --> 00:05:21,550
Pip install.

83
00:05:21,640 --> 00:05:26,260
It will install all the packages that are required listed in this requirements.txt file.

84
00:05:26,260 --> 00:05:28,030
And I will now click on enter.

85
00:05:28,540 --> 00:05:32,440
So now all these packages will be get installed over here.

86
00:05:40,820 --> 00:05:44,330
So this will take some time, but all these packages to get installed.

87
00:05:44,720 --> 00:05:49,640
So let's wait for these packages to get installed and then we will go ahead.

88
00:06:01,270 --> 00:06:03,790
Now you can see that the packages are installed.

89
00:06:03,790 --> 00:06:08,620
So now in the step number three, what we need to do is we need to download a Deepsort files.

90
00:06:08,620 --> 00:06:12,160
So I will just copy this link from here.

91
00:06:13,700 --> 00:06:14,090
Yes.

92
00:06:14,090 --> 00:06:14,810
Copy this.

93
00:06:16,990 --> 00:06:17,500
Okay.

94
00:06:17,500 --> 00:06:23,380
And I will just paste this link over here and I just click on enter.

95
00:06:23,380 --> 00:06:29,380
So this will download the Deepsort files from the drive into this Google Colab notebook or into this

96
00:06:29,380 --> 00:06:30,190
PyCharm ID.

97
00:06:30,370 --> 00:06:36,250
So I've already placed this deepsort zip file into my drive, and I'm directly downloading the Deepsort

98
00:06:36,250 --> 00:06:40,450
PyTorch zip file, uh, from my drive into this PyCharm IDE.

99
00:06:40,720 --> 00:06:44,050
Uh, so now we just need to unzip this deepsort files.

100
00:06:44,050 --> 00:06:51,520
So what I will do for this, I will just, uh, click over here and create a new script.py file.

101
00:06:52,540 --> 00:06:54,100
Uh, in the script or by file.

102
00:06:54,100 --> 00:06:58,810
I will just write some code, uh, to zip, uh, unzip these deepsort files.

103
00:07:05,340 --> 00:07:06,900
So over here.

104
00:07:10,170 --> 00:07:10,980
Import.

105
00:07:10,980 --> 00:07:13,710
I will just write over here import zip file.

106
00:07:16,030 --> 00:07:17,710
With zip file.

107
00:07:20,140 --> 00:07:20,410
Uh.

108
00:07:22,360 --> 00:07:23,410
Not zip file.

109
00:07:27,450 --> 00:07:32,130
Here I will just write the name which is deepsort by dot dot zip.

110
00:07:34,080 --> 00:07:35,700
But we need to read this.

111
00:07:37,590 --> 00:07:41,070
As the dash ref.

112
00:07:43,750 --> 00:07:46,900
And we need to extract all these complete files.

113
00:07:46,900 --> 00:07:48,370
So just do this.

114
00:07:48,610 --> 00:07:53,170
And over here I will just run this script file.

115
00:07:55,160 --> 00:07:57,050
And let's see how does it works.

116
00:07:57,080 --> 00:07:57,650
Okay.

117
00:07:57,650 --> 00:07:59,180
So do we have the okay.

118
00:07:59,180 --> 00:08:03,800
So now you can see I've just, uh, completely unzipped this file over here.

119
00:08:04,040 --> 00:08:04,640
Okay.

120
00:08:04,640 --> 00:08:07,670
So there is a function in Python unzip.

121
00:08:07,670 --> 00:08:10,580
But that function does not work in PyCharm.

122
00:08:10,580 --> 00:08:13,040
I have tried that function in Google Colab.

123
00:08:13,040 --> 00:08:15,770
It works fine there, but that doesn't work in PyCharm.

124
00:08:15,770 --> 00:08:19,880
So in the deepsort PyTorch, uh, if I have not unzipped it.

125
00:08:19,880 --> 00:08:25,550
So you can see here we have a Deepsort folder where we have the uh, complete deepsort.py file code

126
00:08:25,550 --> 00:08:26,120
as well.

127
00:08:26,120 --> 00:08:29,390
And we have the configuration and readme file over here as well.

128
00:08:29,390 --> 00:08:32,660
So this is what we all require okay.

129
00:08:33,530 --> 00:08:39,260
Next what we need to do is we need to download a demo video from here.

130
00:08:39,260 --> 00:08:41,660
So I've already added the link over here.

131
00:08:41,660 --> 00:08:46,430
So okay so then we are just uh good as well.

132
00:08:46,430 --> 00:08:50,720
So now in the terminal I will just write add the link over here.

133
00:08:50,720 --> 00:08:56,150
So this will download a demo video from a drive into this PyCharm IDE over here.

134
00:08:57,220 --> 00:08:57,550
Okay.

135
00:08:57,550 --> 00:09:02,470
So now you can see we have the demo video over here as well.

136
00:09:02,470 --> 00:09:06,310
So if I just re okay so no need to.

137
00:09:06,310 --> 00:09:08,500
So you can see here test dot mp4.

138
00:09:08,500 --> 00:09:13,990
Uh we have this demo video over here as well on which we will be doing detection and tracking okay.

139
00:09:15,810 --> 00:09:23,910
So in next part I will do is um, so in the detect.py we have all the object detection code.

140
00:09:23,910 --> 00:09:30,390
So I will just add another file detect dash du that tracking.py in which we will be doing object detection

141
00:09:30,390 --> 00:09:32,040
plus tracking over here.

142
00:09:35,230 --> 00:09:39,670
Over here you can see that I have added detect-dual-tracking.py file.

143
00:09:39,670 --> 00:09:42,610
So here I will be uh, adding the deepsort code.

144
00:09:42,610 --> 00:09:48,310
I have added some deepsort code over here which include initialization initialization of Deepsort algorithm.

145
00:09:48,310 --> 00:09:54,730
So over here what I have done for now is I have initialized or I have imported all the Deepsort required

146
00:09:54,730 --> 00:09:57,430
packages over here, which you can see over here.

147
00:09:57,430 --> 00:10:00,190
And then I have initialized Deepsort over here.

148
00:10:00,190 --> 00:10:05,770
I have initialized the Deepsort tracker over here, and all the parameters which you can find over here.

149
00:10:05,770 --> 00:10:09,160
So the important parameter we should, which you should need to know.

150
00:10:09,160 --> 00:10:12,700
I have uh, written all the comments about each of the parameter above.

151
00:10:12,700 --> 00:10:14,050
You can read that as well.

152
00:10:14,050 --> 00:10:16,540
So here is the maximum age parameter.

153
00:10:16,540 --> 00:10:19,480
So you should uh need to know about that parameter.

154
00:10:19,480 --> 00:10:26,800
So in the maximum age uh what we define is that for example uh due to an occlusion or if uh, for any,

155
00:10:26,800 --> 00:10:32,770
in any case, if an object tracking ID is lost for an object, um, so in the maximum age we define

156
00:10:32,770 --> 00:10:36,730
how many frames it should wait to get that, uh, ID back.

157
00:10:36,730 --> 00:10:43,570
So, uh, for example, if there is a car and we have lost that, uh, car object tracking ID due to

158
00:10:43,570 --> 00:10:48,610
an illusion, so how many frames that it should wait for it to get back?

159
00:10:48,610 --> 00:10:53,650
Or if it doesn't get back in this much frames, then it will assign a new ID.

160
00:10:53,680 --> 00:10:57,940
So for example, if I set the maximum age value to 20.

161
00:10:57,940 --> 00:11:05,290
So it will wait 20 frames, uh, to get the object tracking ID back, and if in 20 frames it does not

162
00:11:05,290 --> 00:11:11,020
get the object tracking ID back for that specific object, it will assign that object a new ID.

163
00:11:11,020 --> 00:11:17,530
So if you can see over here if an object tracking ID is lost, this parameter determines how many frames

164
00:11:17,530 --> 00:11:18,850
the tracker should wait.

165
00:11:18,910 --> 00:11:24,790
Wait before assigning a new ID so you can see all the details over I have written over here.

166
00:11:26,210 --> 00:11:32,480
Then over here I have to define the minimum confidence, maximum distance and the RMS maximum overlap

167
00:11:32,480 --> 00:11:34,070
maximum IOU distance.

168
00:11:34,070 --> 00:11:35,960
So you can read all those comments.

169
00:11:36,320 --> 00:11:38,300
I define every parameter over here.

170
00:11:38,450 --> 00:11:41,270
This will take quite some time so I will skip this.

171
00:11:41,270 --> 00:11:44,420
And here I've just created a function initialized Deepsort.

172
00:11:44,420 --> 00:11:47,120
So I have just uh initialized that over here.

173
00:11:47,360 --> 00:11:47,900
Okay.

174
00:11:47,900 --> 00:11:53,090
And here I have uh, because our YOLO v nine model has been trained on the Coco data set.

175
00:11:53,090 --> 00:11:55,850
So the Coco dataset consists of 80 different classes.

176
00:11:55,850 --> 00:11:59,090
So I have written all those 80 different classes names over here.

177
00:11:59,090 --> 00:12:02,780
And then uh, for example here I've defined the color label.

178
00:12:02,780 --> 00:12:09,560
So if we have the if the if in a video frame or in a live webcam feed, uh, person is detected, then

179
00:12:09,560 --> 00:12:15,740
we have assigned, uh, if the person is detected in a live webcam feed or in a video, then the bounding

180
00:12:15,740 --> 00:12:17,840
boxes will have the following color.

181
00:12:17,840 --> 00:12:21,560
So if the car is detected, then the bounding boxes will have the following color.

182
00:12:21,560 --> 00:12:27,170
If the motorbike is detected in a video frame image or in a live webcam feed, then the bounding boxes

183
00:12:27,170 --> 00:12:28,370
will have the following color.

184
00:12:28,370 --> 00:12:33,590
And if the box bus is detected in a video frame or in a live webcam feed, then the bounding boxes will

185
00:12:33,590 --> 00:12:34,400
have this color.

186
00:12:35,970 --> 00:12:36,390
Okay.

187
00:12:36,480 --> 00:12:39,810
And over here, uh, they we have loaded the model.

188
00:12:39,810 --> 00:12:42,060
We have applied non-expression over here.

189
00:12:42,060 --> 00:12:44,370
So this is all what is going over here?

190
00:12:44,370 --> 00:12:48,450
So from now where I will just add the object tracking code.

191
00:12:48,450 --> 00:12:49,470
Let me show you.

192
00:12:49,470 --> 00:12:53,400
So from here I will start adding the object tracking code over here.

193
00:12:54,820 --> 00:12:59,230
But before I add this so you can see over here okay.

194
00:12:59,380 --> 00:13:04,210
So so in the YOLO v nine we get the output in this form.

195
00:13:04,210 --> 00:13:08,530
Like you can see that uh, the Yolo v nine object detection algorithm returns the output.

196
00:13:08,530 --> 00:13:10,720
In this form we have the bounding box coordinates.

197
00:13:10,720 --> 00:13:15,880
We have the uh top right corner uh top left corner bounding box coordinate.

198
00:13:15,880 --> 00:13:19,120
You can see this is the top left corner and this is the bottom right corner.

199
00:13:19,120 --> 00:13:26,260
So the in the yolo uh, the yolo v nine uh, model outputs return the top left corner bounding box coordinate

200
00:13:26,260 --> 00:13:29,950
and the bottom right corner bounding box coordinates.

201
00:13:29,950 --> 00:13:35,740
So this is what yolo v nine returns top left corner bounding box coordinates and the bottom bottom right

202
00:13:35,890 --> 00:13:37,690
corner bounding box coordinates.

203
00:13:37,690 --> 00:13:43,030
So we need to pass the Yolo v nine object detection algorithm output to the Deepsort algorithm.

204
00:13:43,030 --> 00:13:50,260
So the Deepsort object tracking algorithm, uh, accepts uh the input in the form of width height of

205
00:13:50,260 --> 00:13:51,310
the bounding box.

206
00:13:51,760 --> 00:13:54,160
So this is the width okay.

207
00:13:54,160 --> 00:13:54,820
Here I'm wrong.

208
00:13:54,820 --> 00:13:55,960
This is the height.

209
00:13:55,960 --> 00:13:59,620
So this is wrong if I just, uh, correct this up over here.

210
00:14:00,220 --> 00:14:00,610
Okay.

211
00:14:00,610 --> 00:14:02,290
So this is.

212
00:14:03,320 --> 00:14:05,780
Uh, so let me just correct this.

213
00:14:06,410 --> 00:14:08,360
So this is basically.

214
00:14:09,870 --> 00:14:15,270
The height, and this is the width of the bounding box.

215
00:14:15,270 --> 00:14:21,810
So the Deepsort object tracking algorithm accepts input in the form of height, width of the bounding

216
00:14:21,810 --> 00:14:25,380
box and the center coordinates of the bounding box.

217
00:14:25,380 --> 00:14:30,270
So these are the four parameters that are required, uh, that we should pass in.

218
00:14:30,270 --> 00:14:35,010
The input of the Deepsort object tracking algorithm is the center coordinates of the bounding boxes,

219
00:14:35,010 --> 00:14:38,970
and the width and the height, width and the height of the bounding boxes.

220
00:14:38,970 --> 00:14:45,300
So from the Yolo v9 object detection algorithm, we get the uh top left corner, uh top left corner

221
00:14:45,300 --> 00:14:50,280
bounding box coordinates, and the bottom right corner bounding box coordinates.

222
00:14:50,280 --> 00:14:53,130
So this is what we get from the Yolo v9 output.

223
00:14:53,130 --> 00:14:59,790
So we need to transform that output into the height and width of the bounding boxes and the center coordinates

224
00:14:59,790 --> 00:15:02,010
of the bounding boxes.

225
00:15:03,020 --> 00:15:04,490
So first we need to do this.

226
00:15:04,520 --> 00:15:10,130
We need to transform the benign output into this height width and the center coordinates of the bounding

227
00:15:10,130 --> 00:15:10,520
boxes.

228
00:15:11,180 --> 00:15:13,340
So over here I will start writing the code.

229
00:15:22,340 --> 00:15:26,000
So from, um, nine, we get that, uh.

230
00:15:27,130 --> 00:15:31,750
Top left corner bounding box and the bottom right corner bounding box coordinates, which we are here.

231
00:15:31,780 --> 00:15:35,500
Thus, we also get the confidence score and the class names.

232
00:15:39,520 --> 00:15:42,850
So these are the output we get from the YOLO v9.

233
00:15:44,440 --> 00:15:47,470
So here you can just write.

234
00:15:47,470 --> 00:15:50,710
So X1Y1 represents the top left corner.

235
00:15:50,710 --> 00:15:52,840
And X2Y2 represents the bottom right corner.

236
00:15:52,840 --> 00:15:53,980
Bounding box coordinates.

237
00:15:57,690 --> 00:16:00,120
So the output in the form of tensors.

238
00:16:00,120 --> 00:16:02,460
We need to convert the output into integers first.

239
00:16:02,460 --> 00:16:13,680
So I will just write over here int x one, int y one and x two and int y two.

240
00:16:14,430 --> 00:16:17,550
So we need to have transformed the output from tensors into integers.

241
00:16:20,150 --> 00:16:21,950
So now we will find the.

242
00:16:24,000 --> 00:16:25,560
Enter coordinates.

243
00:16:27,530 --> 00:16:29,120
For each of the.

244
00:16:31,280 --> 00:16:33,140
Detected object.

245
00:16:36,840 --> 00:16:42,690
So, as I told you, that in Deepsort algorithm, uh, we need to pass the input in the form of center

246
00:16:42,690 --> 00:16:48,810
coordinates for each of the bounding box of the detected object and the width and height of the bounding

247
00:16:48,810 --> 00:16:49,530
boxes.

248
00:16:50,450 --> 00:16:50,690
Okay.

249
00:16:50,720 --> 00:16:53,450
So we will find the center coordinates first.

250
00:16:53,960 --> 00:16:57,380
And then we'll find the width and the height of the bounding boxes as well.

251
00:16:58,760 --> 00:17:00,620
So I will just ride over here.

252
00:17:17,760 --> 00:17:19,500
So here I will just find the width.

253
00:17:22,940 --> 00:17:24,140
Eye of the.

254
00:17:25,860 --> 00:17:26,220
Only.

255
00:17:38,840 --> 00:17:40,700
So to find the weight.

256
00:17:40,820 --> 00:17:45,350
So you can say that, uh, basically we here we have x1.

257
00:17:45,980 --> 00:17:46,340
Okay.

258
00:17:46,340 --> 00:17:48,980
So if I just write over here.

259
00:17:50,580 --> 00:17:50,760
And.

260
00:17:51,810 --> 00:17:53,070
And X1.

261
00:17:54,220 --> 00:17:56,110
And here we have.

262
00:17:57,470 --> 00:17:58,700
Uh x2.

263
00:17:59,880 --> 00:18:03,150
So if we subtract x one from x two, we get the width.

264
00:18:03,150 --> 00:18:06,690
And if we subtract y one from y two, we get the height.

265
00:18:10,300 --> 00:18:15,550
So I will just I will just write over here x one minus x four.

266
00:18:15,550 --> 00:18:17,410
So this will give me the weight.

267
00:18:17,410 --> 00:18:21,640
And for the height I will just write over here.

268
00:18:30,680 --> 00:18:32,630
For the Deepsort algorithm.

269
00:18:32,630 --> 00:18:35,450
Accept input in the form of.

270
00:18:36,900 --> 00:18:40,170
Center coordinates and width and height of the bounding box.

271
00:18:42,980 --> 00:18:44,390
We'll be right over here.

272
00:18:44,600 --> 00:18:44,870
We're.

273
00:18:53,770 --> 00:18:54,130
Okay.

274
00:18:56,590 --> 00:18:59,440
So now we need to append all these width.

275
00:18:59,440 --> 00:18:59,950
And how?

276
00:18:59,950 --> 00:19:03,940
Because in a frame there will be multiple objects that will be detected.

277
00:19:03,940 --> 00:19:11,230
And so we have uh center coordinates for their multiple objects and width and height or values for multiple

278
00:19:11,230 --> 00:19:16,180
objects that are detected in our video frame in image or in live webcam feed.

279
00:19:19,450 --> 00:19:22,960
So I will just here append dot append.

280
00:19:25,840 --> 00:19:26,500
Okay.

281
00:19:28,460 --> 00:19:33,200
Then I will also append all the confidence values over here as well.

282
00:19:40,270 --> 00:19:44,140
Plus we have also have these class, uh, IDs as well.

283
00:19:44,140 --> 00:19:47,470
For example, the class ID for the person class is zero.

284
00:19:47,470 --> 00:19:49,870
So but these values in the form of tensors.

285
00:19:49,870 --> 00:19:53,860
So we need to transform those values from tensors into integers as well.

286
00:20:05,970 --> 00:20:09,090
And I will append these values over here.

287
00:20:16,450 --> 00:20:17,650
And, uh.

288
00:20:17,650 --> 00:20:19,300
Okay, so that's done.

289
00:20:20,920 --> 00:20:22,240
Then we have.

290
00:20:24,960 --> 00:20:28,080
So now we need to convert these values into tensors again.

291
00:20:50,300 --> 00:20:58,310
And as I told you, that a deepsort algorithm accept, uh, input in the form of, uh, Deepsort algorithm.

292
00:20:58,310 --> 00:21:03,740
Object tracking algorithm in accepts input in the form of, uh, center coordinates and width and height

293
00:21:03,740 --> 00:21:04,760
of the bounding boxes.

294
00:21:04,760 --> 00:21:07,970
And along with the confidence score and the class names.

295
00:21:10,610 --> 00:21:12,560
Uh, content store and the class IDs.

296
00:21:12,560 --> 00:21:15,530
We don't have the class names yet, so.

297
00:21:18,080 --> 00:21:25,520
So as we have transformed our output in the form of tensors and then have confidence score over here

298
00:21:26,060 --> 00:21:26,960
as well.

299
00:21:30,240 --> 00:21:32,430
So here we have the class IDs.

300
00:21:35,190 --> 00:21:40,290
And is IMS represents the current frame in which we will be doing this.

301
00:21:42,960 --> 00:21:48,060
So if we have deductions like if we have some deductions for.

302
00:21:49,010 --> 00:21:51,410
Then we will be doing the tracking as well.

303
00:21:53,920 --> 00:21:54,880
So.

304
00:21:55,360 --> 00:22:01,780
So now you can see over here, uh, in the Deepsort object tracking algorithm, our input, we have

305
00:22:01,780 --> 00:22:07,000
passed the centre coordinates, width and height of the bounding boxes and the confidence score and

306
00:22:07,000 --> 00:22:08,800
the class IDs and the current frame.

307
00:22:08,890 --> 00:22:12,490
So the what output we get from the Deepsort algorithm.

308
00:22:12,490 --> 00:22:15,400
So here in the Deepsort algorithm.

309
00:22:15,400 --> 00:22:17,080
So if I just write.

310
00:22:18,190 --> 00:22:18,790
What year?

311
00:22:19,690 --> 00:22:21,220
Deepsort algorithm.

312
00:22:23,070 --> 00:22:23,640
Output.

313
00:22:24,240 --> 00:22:25,230
So.

314
00:22:29,010 --> 00:22:30,570
So this is what we get.

315
00:22:30,840 --> 00:22:33,390
If I just again zoom it up for the.

316
00:22:57,730 --> 00:22:59,200
Okay, so here we can.

317
00:23:14,700 --> 00:23:18,180
So in the Deepsort algorithm output, we get a.

318
00:23:19,390 --> 00:23:21,070
Uh, the bounding top, right?

319
00:23:21,100 --> 00:23:28,780
Uh, uh, now, this is a top left corner bounding box coordinate, and, uh, the bottom right, uh,

320
00:23:28,780 --> 00:23:29,800
bounding box coordinate.

321
00:23:29,800 --> 00:23:34,930
So Deepsort algorithm output returns the top left corner bounding box coordinate and the bottom right

322
00:23:34,930 --> 00:23:37,810
corner bounding box coordinates, which you can find over here.

323
00:23:37,810 --> 00:23:40,870
So we get the bounding box coordinates in the Deepsort algorithm.

324
00:23:40,870 --> 00:23:45,310
Output a unique ID for each of the detected objects, plus the Deepsort algorithm.

325
00:23:45,310 --> 00:23:46,780
Also return the class ID.

326
00:23:46,780 --> 00:23:49,030
For example, for the person class, it's zero.

327
00:23:49,030 --> 00:23:53,020
So there are three things that we get from the Deepsort algorithm output.

328
00:23:53,020 --> 00:23:54,940
One is the bounding box coordinates.

329
00:23:54,940 --> 00:23:58,360
The second thing is the unique ID for each of the detected object.

330
00:23:58,360 --> 00:23:59,860
This is what we do in object tracking.

331
00:23:59,860 --> 00:24:04,600
In object tracking, we assign a unique ID to each of the detected object, and we also get the class

332
00:24:04,600 --> 00:24:06,700
ID for each of the class.

333
00:24:06,700 --> 00:24:09,640
For example, for person class, the class ID will be zero.

334
00:24:09,640 --> 00:24:11,800
So in the bounding box coordinate we get the.

335
00:24:13,090 --> 00:24:17,590
Top left corner bounding box coordinates and the bottom right corner bounding box coordinates.

336
00:24:20,420 --> 00:24:21,020
Okay.

337
00:24:21,020 --> 00:24:22,130
So.

338
00:24:23,530 --> 00:24:25,780
First thing will I will write over here.

339
00:24:25,780 --> 00:24:28,030
First we get the bounding box coordinate.

340
00:24:28,030 --> 00:24:33,700
We get the top left corner bounding box coordinates and the bounding bottom right corner bounding box

341
00:24:33,700 --> 00:24:34,330
coordinates.

342
00:24:42,420 --> 00:24:47,460
Unless we get the IDs for unique IDs for each of the detected object.

343
00:24:59,130 --> 00:25:04,200
Plus we also get the object ID, for example, for the person class, the object ID zero, and for the

344
00:25:04,200 --> 00:25:05,820
car class it's 1 or 2.

345
00:25:13,480 --> 00:25:19,510
Okay, so now we need to draw those bounding boxes around each of the detected object.

346
00:25:19,510 --> 00:25:23,050
And we need to add the ID uh for this as well.

347
00:25:23,050 --> 00:25:26,650
So I will be creating a function by the name draw dash boxes.

348
00:25:26,650 --> 00:25:27,430
And.

349
00:25:28,680 --> 00:25:34,590
In the drawer dash boxes, as I will be writing the code so that I can draw bounding boxes around each

350
00:25:34,590 --> 00:25:35,550
of the detected object.

351
00:25:35,550 --> 00:25:42,450
Assign a unique ID for each of the object, and write the class name above each of the detected objects.

352
00:25:42,450 --> 00:25:42,990
So.

353
00:25:44,320 --> 00:25:47,290
So in the input I will pass in the bounding box coordinates.

354
00:25:47,890 --> 00:25:48,310
The.

355
00:25:49,360 --> 00:25:52,030
Then I will be, uh, drawing the trails.

356
00:25:52,030 --> 00:25:55,150
So to see what path the object is following.

357
00:25:55,150 --> 00:25:57,160
So to track the path.

358
00:25:58,980 --> 00:26:02,820
Then I will be passing a unique ID for each detected object in the input.

359
00:26:04,650 --> 00:26:08,940
And, uh, object ID, which is the class ID as well.

360
00:26:08,940 --> 00:26:12,480
So the object is basically the class ID like for the person class is zero.

361
00:26:12,480 --> 00:26:14,550
So these will be all the inputs.

362
00:26:14,550 --> 00:26:15,990
So let's write that door.

363
00:26:15,990 --> 00:26:17,190
Dash box is function.

364
00:26:23,030 --> 00:26:25,700
Okay, so you can just get around this.

365
00:26:30,030 --> 00:26:35,070
So here I will be creating a writing down the code for the function draw dash boxes.

366
00:26:36,340 --> 00:26:38,320
The input will be the frame.

367
00:26:41,900 --> 00:26:43,520
The bounding box coordinates.

368
00:26:44,420 --> 00:26:47,150
Dot rail so that we can track the path.

369
00:26:48,630 --> 00:26:50,130
The identities.

370
00:26:52,700 --> 00:26:56,060
So we can initially set these values to none over here.

371
00:26:57,700 --> 00:27:02,470
Then we have the categories as well, so we can set this as none as well.

372
00:27:03,200 --> 00:27:06,290
So categories are basically the class IDs.

373
00:27:07,780 --> 00:27:09,310
Then we have the offset.

374
00:27:09,310 --> 00:27:11,140
We can set this to zero.

375
00:27:12,760 --> 00:27:14,080
So let's try down the code.

376
00:27:14,080 --> 00:27:15,400
Complete code over here.

377
00:27:18,160 --> 00:27:22,630
So let's find out the height and width of the current frame.

378
00:27:30,350 --> 00:27:31,010
Okay.

379
00:27:31,690 --> 00:27:33,550
Then I will write.

380
00:27:34,780 --> 00:27:35,080
Okay.

381
00:27:37,190 --> 00:27:38,900
For a common box.

382
00:27:41,200 --> 00:27:44,620
So now we will look through each of the bounding box coordinates.

383
00:27:44,740 --> 00:27:45,310
Okay.

384
00:27:51,710 --> 00:27:52,220
Oh no.

385
00:27:52,220 --> 00:27:57,200
I'm looping through each of the bounding box coordinates over here.

386
00:28:09,330 --> 00:28:10,320
So.

387
00:28:11,720 --> 00:28:13,580
Um, in the bounding box coordinates.

388
00:28:13,580 --> 00:28:16,490
Let's add some offset value over here.

389
00:28:37,280 --> 00:28:37,520
And.

390
00:28:42,270 --> 00:28:44,490
So here we have defined the offset value over here.

391
00:28:44,490 --> 00:28:49,620
So so now we are looping through each of uh all the uh bounding boxes.

392
00:28:49,620 --> 00:28:54,420
And here we are just getting the coordinates values for each of the bounding boxes.

393
00:28:54,420 --> 00:28:58,020
So we are looking through each of the bounding box coordinates one by one.

394
00:29:00,530 --> 00:29:03,830
For now, we can find the center point of the bounding box.

395
00:29:03,830 --> 00:29:05,810
So find the center point.

396
00:29:06,170 --> 00:29:06,410
The.

397
00:29:27,060 --> 00:29:30,060
So here we are, just finding the center point of the bounding box.

398
00:29:31,800 --> 00:29:33,480
Then over here.

399
00:29:37,690 --> 00:29:43,090
We are calculating the class IDs for each of the detected object.

400
00:29:57,570 --> 00:30:00,180
Then, uh, using the class IDs.

401
00:30:00,180 --> 00:30:04,950
For example, if the there is a person, then we will have the bounding boxes will have this color.

402
00:30:05,310 --> 00:30:07,500
So we will simply write over here.

403
00:30:11,450 --> 00:30:13,610
And here we will pass the class ID.

404
00:30:18,580 --> 00:30:23,530
Then for each of the detected object, we will have a unique ID for each detected object so that we

405
00:30:23,530 --> 00:30:25,330
can track that object using that ID.

406
00:30:25,330 --> 00:30:30,220
So, uh, in that entities, we have the unique ID for each of the detected object.

407
00:30:35,180 --> 00:30:35,630
Um.

408
00:30:50,650 --> 00:30:55,690
So now we will just, uh, draw a rectangle around each of the detected object.

409
00:30:59,060 --> 00:31:05,990
Or you can simply say we are drawing bounding boxes around each of the detected objects.

410
00:31:09,700 --> 00:31:12,430
And the thickness of the bounding boxes will be two.

411
00:31:21,330 --> 00:31:28,020
So now what we will doing is that we will be using that ID so that if the ID is zero, then the there

412
00:31:28,020 --> 00:31:28,980
will be person class.

413
00:31:28,980 --> 00:31:30,360
If the ID is one, then bicycle.

414
00:31:30,360 --> 00:31:32,940
If the ID two is then it belongs to the car class.

415
00:31:33,300 --> 00:31:33,870
So.

416
00:31:35,150 --> 00:31:38,750
So in the category, we have the ID for each of the class.

417
00:31:39,420 --> 00:31:42,150
And using that ID will find the class name.

418
00:31:47,500 --> 00:31:52,720
So in the label, what we will display is that, uh, first I will display the ID.

419
00:31:58,090 --> 00:32:01,510
Then we have the class name over there as well.

420
00:32:04,710 --> 00:32:11,520
But so do things we have in our, uh, uh, above the bounding boxes where we will display the ID unique

421
00:32:11,520 --> 00:32:13,560
ID, and then we have the class name.

422
00:32:13,560 --> 00:32:15,870
We will not be displaying the confidence score over there.

423
00:32:18,440 --> 00:32:20,840
So now we're finding the text size.

424
00:32:33,460 --> 00:32:36,100
Or we want to team up on that 0.5.

425
00:33:06,360 --> 00:33:09,900
Now we will be creating a rectangle above the bounding boxes as well.

426
00:33:21,510 --> 00:33:25,080
And we want the rectangle to be filled, so we'll just write minus one.

427
00:33:27,070 --> 00:33:31,870
And then we will be adding the text in the rectangle which we have created above the bounding box.

428
00:33:32,320 --> 00:33:40,750
In the text, we will be displaying the label which contains the class name and the uh with uh id unique

429
00:33:40,750 --> 00:33:41,830
ID of that object.

430
00:33:44,600 --> 00:33:47,420
Just setting the location of that label.

431
00:33:52,630 --> 00:33:54,070
I mean, the color will be.

432
00:33:55,030 --> 00:33:57,070
White for the text.

433
00:34:04,300 --> 00:34:06,550
And the thickness of the text will be one.

434
00:34:16,440 --> 00:34:22,170
So now we will be creating a circle at the center of each of the object.

435
00:34:40,050 --> 00:34:42,660
Okay, so now we have run this code.

436
00:34:42,660 --> 00:34:46,140
Plus we also want to draw the trails over here as well.

437
00:34:48,420 --> 00:34:51,450
So we can track the path the object is following.

438
00:34:54,180 --> 00:34:57,480
So I will just write down the code for this over here as well.

439
00:35:18,550 --> 00:35:19,030
Okay.

440
00:35:29,120 --> 00:35:29,300
Right.

441
00:35:36,750 --> 00:35:39,930
If I lean not in data deck.

442
00:35:40,020 --> 00:35:43,710
So data deck is a type of dictionary that we have initialized above.

443
00:35:49,190 --> 00:35:51,560
And it has a maximum length of.

444
00:36:00,270 --> 00:36:01,140
64.

445
00:36:26,650 --> 00:36:27,010
Okay.

446
00:36:27,010 --> 00:36:30,460
So now we'll just write over here if Broad Trail.

447
00:36:30,460 --> 00:36:32,620
So if the user wants to draw the trails.

448
00:36:34,330 --> 00:36:36,250
For I in range.

449
00:37:05,850 --> 00:37:06,840
Is none.

450
00:37:25,000 --> 00:37:25,480
Oh, no.

451
00:37:25,480 --> 00:37:27,580
We'll just get greater thickness over here.

452
00:37:32,420 --> 00:37:36,620
So we need to initialize the numpy package at the start over here as well.

453
00:37:37,100 --> 00:37:41,210
So I will just write import numpy as np.

454
00:37:42,380 --> 00:37:44,120
Okay okay.

455
00:37:44,300 --> 00:37:45,170
If okay.

456
00:37:45,170 --> 00:37:46,850
So we have already imported this.

457
00:37:46,850 --> 00:37:48,770
So no need to export that.

458
00:37:48,770 --> 00:37:49,820
Not imported.

459
00:38:03,100 --> 00:38:03,640
Or.

460
00:38:07,400 --> 00:38:10,910
We need to multiply this by 0.5 over here.

461
00:38:14,750 --> 00:38:16,910
Or we can make it 1.5.

462
00:38:21,750 --> 00:38:23,580
Next we need to draw the trail.

463
00:38:23,580 --> 00:38:28,470
So to draw the trails we will be using CV two dot line so that we can draw trails.

464
00:38:29,960 --> 00:38:31,400
The input will reframe.

465
00:38:34,470 --> 00:38:34,770
Okay.

466
00:38:41,540 --> 00:38:42,230
One.

467
00:38:44,310 --> 00:38:46,650
And here we have data dq ID.

468
00:38:48,010 --> 00:38:48,910
One.

469
00:38:50,700 --> 00:38:54,690
Then we have the color and the thickness as our input as well.

470
00:38:54,690 --> 00:38:55,470
And.

471
00:39:03,890 --> 00:39:06,140
So that's quite fine for now.

472
00:39:07,590 --> 00:39:13,470
I think I have written all this, so let me execute this script file and show you how our output looks

473
00:39:13,470 --> 00:39:14,070
like.

474
00:39:16,620 --> 00:39:21,030
Before I run this, I forgot that I have not downloaded, uh, the model weights.

475
00:39:21,960 --> 00:39:27,240
So I will just go over here and just click over here and the model weights will start downloading.

476
00:39:27,600 --> 00:39:33,390
So if I just go over here let me just close these files.

477
00:39:35,010 --> 00:39:35,130
And.

478
00:39:36,250 --> 00:39:40,300
So I should have over here the model which saved.

479
00:39:41,530 --> 00:39:44,290
So if I just check over here.

480
00:39:44,320 --> 00:39:45,310
Okay.

481
00:39:46,870 --> 00:39:48,370
Uh, so let's wait for this model.

482
00:39:48,370 --> 00:39:49,720
Weights to get downloaded.

483
00:39:51,790 --> 00:39:54,100
So it will take a few more seconds for this model.

484
00:39:54,100 --> 00:39:56,110
Weights to get downloaded.

485
00:39:59,560 --> 00:39:59,800
Okay.

486
00:39:59,800 --> 00:40:01,750
So they are about to complete okay.

487
00:40:01,750 --> 00:40:02,560
So that's done.

488
00:40:05,770 --> 00:40:10,480
Okay, so let me just add over here.

489
00:40:14,700 --> 00:40:15,960
So I will just add there.

490
00:40:15,960 --> 00:40:16,620
Over here.

491
00:40:16,650 --> 00:40:18,570
Now you can see it.

492
00:40:20,290 --> 00:40:23,830
Okay, so let me just run this, uh, now in the PyCharm.

493
00:40:23,830 --> 00:40:26,740
So let me just run the script and show you how our output looks like.

494
00:40:29,960 --> 00:40:36,320
Now to run this up over here, we just need to write this Python detect-dual-tracking.py.

495
00:40:36,320 --> 00:40:39,920
Here we I will just define the weights file which we have downloaded.

496
00:40:39,920 --> 00:40:41,870
And that's my input video.

497
00:40:41,870 --> 00:40:45,920
And I'm just running it on CPU because I don't have GPU in my local computer.

498
00:40:45,920 --> 00:40:52,550
So CPU and dash video image so that uh, it can show me the output image or output in the it will open

499
00:40:52,550 --> 00:40:55,880
a window where I can see the output video over here as well.

500
00:40:55,880 --> 00:41:00,770
And my output will be saved into this, uh, folder as well.

501
00:41:00,770 --> 00:41:02,630
So that's all this upload.

502
00:41:06,380 --> 00:41:06,650
Okay.

503
00:41:06,650 --> 00:41:08,480
No such file order.

504
00:41:08,630 --> 00:41:12,770
Okay, so I think mistake is on my side.

505
00:41:12,920 --> 00:41:13,460
Let me.

506
00:41:13,580 --> 00:41:16,490
So we need to set the inline folders current directory.

507
00:41:16,490 --> 00:41:17,720
So now let's run this up.

508
00:41:21,540 --> 00:41:21,720
A.

509
00:41:22,880 --> 00:41:26,720
So this will take few seconds before it starts executing over here.

510
00:41:33,540 --> 00:41:37,680
So here we have the model summary gradient zero parameters.

511
00:41:37,830 --> 00:41:39,540
The parameters are in millions.

512
00:41:39,960 --> 00:41:40,230
Okay.

513
00:41:40,230 --> 00:41:41,760
So you can see the output.

514
00:41:41,760 --> 00:41:43,230
Currently there are no detections.

515
00:41:43,230 --> 00:41:50,610
But uh let's see as we go ahead in the frames uh we have any detection or not.

516
00:41:50,760 --> 00:41:51,120
Okay.

517
00:41:51,120 --> 00:41:53,160
So now you can see here we have the detections.

518
00:41:53,160 --> 00:41:58,290
And you can see over here a unique ID is being assigned to each of the person.

519
00:41:58,530 --> 00:41:59,970
So here we have the person.

520
00:42:00,860 --> 00:42:04,520
Now you can see over here the 19 is put unique IDs for this person.

521
00:42:04,520 --> 00:42:09,410
Two unique IDs for this person 28 unique IDs for this person which disappears.

522
00:42:09,410 --> 00:42:15,320
Five unique IDs for this person 17 unique IDs for this person, 15 unique IDs for this person.

523
00:42:15,320 --> 00:42:17,090
And here we have detected the handbag.

524
00:42:17,090 --> 00:42:20,120
So the 30 unique ID is for this person.

525
00:42:20,120 --> 00:42:26,840
The 14 unique ID is for this person, 12 unique ID is for this person 11 unique IDs for this person,

526
00:42:26,840 --> 00:42:29,210
nine unique ID is for this person.

527
00:42:30,660 --> 00:42:37,710
Now the eight unique IDs for this person, 16 unique IDs for this person, 21 unique IDs for this person.

528
00:42:37,710 --> 00:42:41,550
So each of the person is being assigned a unique ID over here.

529
00:42:41,580 --> 00:42:42,090
Okay.

530
00:42:42,090 --> 00:42:46,950
So if you want to draw the trails and plus you can see we have detected a handbag and we have assigned

531
00:42:46,980 --> 00:42:47,850
ID 30.

532
00:42:47,850 --> 00:42:49,410
So as well.

533
00:42:49,410 --> 00:42:53,850
So if you want to draw the trails uh you can just write over here.

534
00:42:56,150 --> 00:42:58,040
Dash dash, draw, dash trails.

535
00:42:58,040 --> 00:43:04,070
And if you want to select any specific class, like if you don't want to detect Hand-bags in the video,

536
00:43:04,070 --> 00:43:06,290
you can just write classes zero.

537
00:43:06,290 --> 00:43:08,180
So zero is for the person class.

538
00:43:08,180 --> 00:43:12,650
So if you want to know more about the class so you can see zero is for the person, class one is for

539
00:43:12,650 --> 00:43:14,690
the bicycle, class two is for the car.

540
00:43:14,690 --> 00:43:16,640
Class three is for the motorbike class.

541
00:43:16,640 --> 00:43:18,740
So here we have listed 80 different classes.

542
00:43:18,740 --> 00:43:22,370
So it starts from zero and ends at 79 okay.

543
00:43:23,790 --> 00:43:25,260
I won't hear in the classes.

544
00:43:25,260 --> 00:43:29,100
You will assign the ID for which specific class you want to detect.

545
00:43:29,100 --> 00:43:32,910
So if you want to detect all the classes, you can skip the classes over here.

546
00:43:32,910 --> 00:43:37,920
But if you want to detect the specific class, you can just pass out the ID of that specific class or

547
00:43:37,920 --> 00:43:38,730
multiple classes.

548
00:43:38,730 --> 00:43:43,080
You can also create a list and pass the ID of the multiple classes that you want to detect.

549
00:43:44,570 --> 00:43:47,600
So now it will not be returning Hand-bags or any other things.

550
00:43:47,780 --> 00:43:53,030
It will only be detecting the person class because we have passed the ID classes as zero and we have

551
00:43:53,030 --> 00:43:54,860
draw that passed draw trail.

552
00:43:54,860 --> 00:43:57,920
So it will be drawing the trails over here as well.

553
00:44:05,070 --> 00:44:06,420
So let's see now.

554
00:44:06,420 --> 00:44:07,980
Currently there are no detections.

555
00:44:07,980 --> 00:44:13,680
After a few frames initial frames we start to see detections usually okay.

556
00:44:17,350 --> 00:44:20,230
So now you can see over here we have the detections.

557
00:44:20,230 --> 00:44:21,970
Uh okay.

558
00:44:22,600 --> 00:44:22,930
Okay.

559
00:44:22,930 --> 00:44:26,380
So now you can see that red center center as well.

560
00:44:26,380 --> 00:44:28,300
So these are the trails which will not be drawn.

561
00:44:28,300 --> 00:44:32,710
So now you can see as the persons go ahead the trails increase as well.

562
00:44:32,710 --> 00:44:35,890
So you can see over here it's a bit slow.

563
00:44:35,890 --> 00:44:38,500
But now you can see that trails is also increasing.

564
00:44:38,500 --> 00:44:42,220
So these are we are just tracking the path that the person is following.

565
00:44:42,220 --> 00:44:44,320
You can also do it for other classes like car.

566
00:44:44,320 --> 00:44:49,270
You can track the path the car is uh going on and so on.

567
00:44:51,020 --> 00:44:54,200
So now you can see I am drawing the trails over here as well.

568
00:44:54,200 --> 00:44:57,920
We have assign a unique ID using object tracking algorithm.

569
00:44:57,920 --> 00:45:02,510
We are also tracking the path the person is following over here as well.

570
00:45:02,810 --> 00:45:07,160
Okay, so this is all we have done in this code.

571
00:45:07,160 --> 00:45:08,960
We are using object tracking algorithm.

572
00:45:08,960 --> 00:45:12,950
We are tracking each of the detected object and we are drawing the trails over here.

573
00:45:12,950 --> 00:45:16,280
So using trails we are tracking the path like you can see.

574
00:45:16,280 --> 00:45:19,580
So this trails length will increase as the person goes ahead.

575
00:45:19,580 --> 00:45:21,230
You can see over here.

576
00:45:23,020 --> 00:45:29,260
These are the trails that we have drawn, and these trail length will increase as the person goes ahead

577
00:45:29,260 --> 00:45:30,520
further as well.

578
00:45:30,820 --> 00:45:31,510
Okay.

579
00:45:31,510 --> 00:45:33,640
So now you can see over here.

580
00:45:42,550 --> 00:45:46,090
So I have run this script on the Google Colab free GPU as well.

581
00:45:46,090 --> 00:45:46,780
So.

582
00:45:46,780 --> 00:45:50,560
So that I can use the GPU and show you the how fast it works.

583
00:45:50,560 --> 00:45:54,370
So I have the demo video out over here with me as well.

584
00:45:54,370 --> 00:45:57,040
So let me just play that demo video.

585
00:45:57,040 --> 00:46:01,240
So I have run this script on GPU, so you can see the processing comes very fast.

586
00:46:01,240 --> 00:46:06,310
And we have uh, it offers good, uh, frame rate at one GPU.

587
00:46:06,310 --> 00:46:09,970
So you can see we have a good number of detections as well.

588
00:46:09,970 --> 00:46:12,250
And it's the speed is very good as well.

589
00:46:12,250 --> 00:46:14,260
So let me show you the output video over here.

590
00:46:14,260 --> 00:46:19,270
So now you can see over here we are able to detect the person we are, have assigned a unique ID to

591
00:46:19,270 --> 00:46:20,770
each of the person as well.

592
00:46:20,770 --> 00:46:22,270
Plus I'm not drawing the trails.

593
00:46:22,270 --> 00:46:27,790
You can draw the trails if you want as well so that you can track the path the person is following or

594
00:46:27,790 --> 00:46:28,810
any other object.

595
00:46:28,810 --> 00:46:35,020
So in this tutorial we have learned how we can track, uh, each of the detected object, uh, by assigning

596
00:46:35,020 --> 00:46:37,900
a unique ID to each of the objective, uh, detected object.

597
00:46:37,900 --> 00:46:42,580
So in this tutorial we have integrated yolo v9 with Deepsort object tracking algorithm.

598
00:46:42,580 --> 00:46:44,020
And we have, uh.

599
00:46:45,420 --> 00:46:51,780
Attract and detect each of the object as well, and we have assigned a unique ID to each of the object.

600
00:46:51,780 --> 00:46:56,820
Plus we have also, uh, drawn trails to track the path the object is following.

601
00:46:56,820 --> 00:46:58,650
So that's all from this tutorial.

602
00:46:58,650 --> 00:46:59,940
Thank you for watching.
