1
00:00:02,000 --> 00:00:03,000
Hello everyone.

2
00:00:03,000 --> 00:00:11,000
In this video tutorial we will see how we can integrate object tracking with YOLO v eight segmentation

3
00:00:11,000 --> 00:00:12,000
to do vehicles counting.

4
00:00:12,000 --> 00:00:16,000
You can see over here and the speed estimation as well.

5
00:00:16,000 --> 00:00:24,000
So this is a complete end to end video tutorial in which we will learn how we can integrate object tracking

6
00:00:24,000 --> 00:00:30,000
with YOLO, V8 segmentation and also how we can do vehicles counting with speed estimation.

7
00:00:30,000 --> 00:00:36,000
So don't skip any part of the video and do watch the complete video and let's get started.

8
00:00:40,000 --> 00:00:44,000
But this is the corner file which I will use in this video tutorial.

9
00:00:44,000 --> 00:00:51,000
As in this video tutorial, we will see how we can use YOLO V8 segmentation with object tracking to

10
00:00:51,000 --> 00:00:54,000
do vehicles counting and speed estimation.

11
00:00:54,000 --> 00:00:56,000
So let's get started.

12
00:00:59,000 --> 00:01:03,000
And the first step, I will explain you the complete code lab code.

13
00:01:03,000 --> 00:01:07,000
Or we can simply say that in the first step I will run this complete code lab script.

14
00:01:07,000 --> 00:01:12,000
So after executing the complete code lab script and showing the output demo video, then I will explain

15
00:01:12,000 --> 00:01:18,000
the complete code in the predict.py file and how you can implement this project on your side.

16
00:01:18,000 --> 00:01:23,000
And the complete understanding of the port will be provided in this video tutorial.

17
00:01:23,000 --> 00:01:30,000
So for this project I will be using this GitHub repo yolo VR segmentation with deep sword object tracking.

18
00:01:30,000 --> 00:01:35,000
I have created this GitHub repo and it's available publicly on GitHub.

19
00:01:35,000 --> 00:01:41,000
So in this GitHub repo we will incorporate the vehicles counting and speed estimation port.

20
00:01:41,000 --> 00:01:48,000
So currently we have the YOLO V8 segmentation with Deepsort object tracking GitHub repo available.

21
00:01:48,000 --> 00:01:53,000
So currently object tracking is being incorporated in the YOLO vs 88 segmentation module.

22
00:01:53,000 --> 00:01:54,000
What next?

23
00:01:54,000 --> 00:02:01,000
We need to do is we need to add vehicles counting and speed estimation code in this already available

24
00:02:01,000 --> 00:02:06,000
code to make it work and able to do the vehicles counting and speed estimation as well.

25
00:02:06,000 --> 00:02:07,000
Okay.

26
00:02:07,000 --> 00:02:10,000
So here I'm just closing this GitHub repo over here.

27
00:02:10,000 --> 00:02:15,000
So by just going over here, copy it and just pasting this path over here.

28
00:02:15,000 --> 00:02:20,000
In the first step, we will clone this GitHub repo into the Google CoLab notebook.

29
00:02:20,000 --> 00:02:25,000
So we will able to assess all the files of this GitHub repo into this Google CoLab notebook.

30
00:02:25,000 --> 00:02:27,000
So just run this cell.

31
00:02:27,000 --> 00:02:34,000
So it will go on the GitHub repo and you will be able to see the clone GitHub repo folder over here.

32
00:02:34,000 --> 00:02:39,000
So now we have the segmentation Deepsort object tracking folder over here.

33
00:02:39,000 --> 00:02:46,000
So now if we see our current directory, our current directory is being set to this project file section.

34
00:02:46,000 --> 00:02:51,000
We need to set our current directory to this folder which we have cloned.

35
00:02:51,000 --> 00:02:54,000
So just copy the path and just paste this over here.

36
00:02:55,000 --> 00:03:00,000
So in the next step, what we need to do, we need to install all the required libraries that are necessary

37
00:03:00,000 --> 00:03:01,000
to run this project.

38
00:03:01,000 --> 00:03:06,000
So if you skip this project, if you skip this step, some libraries might not be installed.

39
00:03:06,000 --> 00:03:11,000
And if you run the training validation or predict.py script, you might face the error that the following

40
00:03:11,000 --> 00:03:16,000
library is not installed or the following library like Hydra library is not install Matplotlib library

41
00:03:16,000 --> 00:03:22,000
is not installed or the Seaborn library is not installed, so it's necessary to install all the required

42
00:03:22,000 --> 00:03:28,000
libraries before, uh, before running the training validation or prediction.py script.

43
00:03:28,000 --> 00:03:35,000
So to install all the required libraries just run this cell so it will install all the required libraries

44
00:03:35,000 --> 00:03:39,000
that are necessary to make this script successfully run.

45
00:03:41,000 --> 00:03:41,000
Okay.

46
00:03:41,000 --> 00:03:47,000
So now as we are doing segmentation, so we'll just go to ultralytics YOLO.

47
00:03:47,000 --> 00:03:54,000
Then I will go to YOLO, then I will go to V8, then I will go to segment and I will select this folder

48
00:03:54,000 --> 00:03:56,000
as my current directory over here.

49
00:03:58,000 --> 00:04:01,000
Okay, so this folder is being set to my current directory.

50
00:04:01,000 --> 00:04:06,000
Now basically we are integrating object tracking with YOLO segmentation.

51
00:04:06,000 --> 00:04:12,000
So to integrate object tracking with YOLO segmentation, we need to have the object tracking files available

52
00:04:12,000 --> 00:04:12,000
as well.

53
00:04:12,000 --> 00:04:18,000
So to implement object tracking, I am using deepsort the state of the art multi multiple object tracking

54
00:04:18,000 --> 00:04:19,000
algorithm.

55
00:04:19,000 --> 00:04:19,000
It is.

56
00:04:19,000 --> 00:04:20,000
Okay.

57
00:04:20,000 --> 00:04:26,000
So in the next in this step I am just downloading the deepsort object tracking files from the google

58
00:04:26,000 --> 00:04:28,000
drive into the our Google CoLab notebook.

59
00:04:30,000 --> 00:04:34,000
So as we are implementing object tracking using Deepsort.

60
00:04:34,000 --> 00:04:41,000
So here I will install or you can say that download the Deepsort files from the Google drive into my

61
00:04:41,000 --> 00:04:42,000
Google CoLab notebook.

62
00:04:42,000 --> 00:04:49,000
So in this way we can integrate the Deepsort object tracking script into our YOLO segmentation.

63
00:04:49,000 --> 00:04:51,000
So now I will zip this file.

64
00:04:51,000 --> 00:04:56,000
So now you can see here we have the Deepsort PyTorch folder over here as we are implementing object

65
00:04:56,000 --> 00:04:58,000
tracking using Deepsort.

66
00:04:58,000 --> 00:05:02,000
So next we need to download a sample video for testing from the Google Drive.

67
00:05:05,000 --> 00:05:05,000
Okay.

68
00:05:05,000 --> 00:05:13,000
So to run the YOLO segmentation model with object tracking, I am just downloading a sample video from

69
00:05:13,000 --> 00:05:14,000
the Google Drive.

70
00:05:14,000 --> 00:05:17,000
So now I'm just downloading the by default.

71
00:05:17,000 --> 00:05:23,000
Here is a predict.py script which will do the object segmentation with object tracking.

72
00:05:23,000 --> 00:05:26,000
But we need to do the vehicles counting and the speed estimation as well.

73
00:05:26,000 --> 00:05:32,000
So I will download the updated predict.py file in which I have cooperated or integrating the vehicles

74
00:05:32,000 --> 00:05:34,000
counting port as well.

75
00:05:35,000 --> 00:05:35,000
Okay.

76
00:05:35,000 --> 00:05:39,000
So I'm just downloading the updated predict.py file.

77
00:05:39,000 --> 00:05:39,000
So.

78
00:05:40,000 --> 00:05:45,000
In this way we can implement the vehicles counting and the speed estimation as well.

79
00:05:45,000 --> 00:05:46,000
Okay.

80
00:05:48,000 --> 00:05:49,000
So that's John's this.

81
00:05:50,000 --> 00:05:52,000
So this might take a few seconds.

82
00:05:52,000 --> 00:05:55,000
And in the end you will get this output demo video here as well.

83
00:05:55,000 --> 00:05:59,000
So we will test on multiple demo videos, which you can see over here.

84
00:05:59,000 --> 00:06:01,000
So let's do it one by one.

85
00:06:04,000 --> 00:06:04,000
Okay.

86
00:06:04,000 --> 00:06:11,000
So basically now I'm running the python predict.py file on a demo video.

87
00:06:11,000 --> 00:06:14,000
Test1 dot mp4 in this.py file.

88
00:06:14,000 --> 00:06:20,000
I have integrated the speed estimation code as well into the object tracking and.

89
00:06:21,000 --> 00:06:22,000
You got a weird segmentation code.

90
00:06:22,000 --> 00:06:30,000
So in the segmentation and object tracking code, I am integrating or adding the speed estimation and

91
00:06:30,000 --> 00:06:32,000
vehicle counting code as well.

92
00:06:32,000 --> 00:06:33,000
Okay.

93
00:06:33,000 --> 00:06:36,000
So vehicle counting and speed estimation.

94
00:06:36,000 --> 00:06:37,000
I think we should write over here.

95
00:06:38,000 --> 00:06:40,000
Vehicle counting and speed estimation.

96
00:06:40,000 --> 00:06:41,000
Okay.

97
00:06:43,000 --> 00:06:50,000
So now I'm just adding the vehicles counting and speed estimation code in the predict.py file.

98
00:06:50,000 --> 00:06:55,000
So predict.py file contained in the predict.py file.

99
00:06:55,000 --> 00:06:59,000
We have integrated object tracking with your segmentation.

100
00:06:59,000 --> 00:07:02,000
Thus we have also added the vehicles counting and speed estimation code.

101
00:07:02,000 --> 00:07:09,000
So when run on this demo video it divides the complete video into 943 frames and it process each of

102
00:07:09,000 --> 00:07:14,000
the frame one by one and it tells the predictions in each of the frame like one person per truck.

103
00:07:14,000 --> 00:07:23,000
So each video frame is each frame in the complete video is divided into 943 frames, and each frame

104
00:07:23,000 --> 00:07:26,000
processing on each of the frame is done.

105
00:07:26,000 --> 00:07:30,000
And here are the results of the processing on each of the frame.

106
00:07:30,000 --> 00:07:31,000
Like 11 cars, one truck.

107
00:07:31,000 --> 00:07:36,000
So the end up using this yellow segment dash segmentation model.

108
00:07:36,000 --> 00:07:41,000
We are doing the processing on this complete video frame by frame.

109
00:07:41,000 --> 00:07:42,000
Okay.

110
00:07:42,000 --> 00:07:47,000
So as this run and we have the output demo video, I will explain this complete code video to you as

111
00:07:47,000 --> 00:07:48,000
well.

112
00:07:48,000 --> 00:07:50,000
So I'm just waiting for this to run.

113
00:07:52,000 --> 00:07:56,000
I have already run the script for this video tutorial so you can see the output demo video over here

114
00:07:56,000 --> 00:07:57,000
as well.

115
00:07:57,000 --> 00:08:03,000
So just to explain you the whole thing, I've just running this script again here, so this might take

116
00:08:03,000 --> 00:08:06,000
few minutes or some more time.

117
00:08:06,000 --> 00:08:07,000
Okay.

118
00:08:09,000 --> 00:08:13,000
LucasArts are running and will complete its.

119
00:08:13,000 --> 00:08:14,000
Okay.

120
00:08:15,000 --> 00:08:20,000
So it's 790 frames, 803 frames, 809 frames.

121
00:08:22,000 --> 00:08:25,000
So what basically we are doing is that let me explain you.

122
00:08:25,000 --> 00:08:32,000
We are integrating object tracking with YOLO segmentation and then we are using object tracking with

123
00:08:32,000 --> 00:08:38,000
YOLO segmentation to add the vehicles counting and speed estimation.

124
00:08:38,000 --> 00:08:42,000
Or you can say to implement the vehicles counting and speed estimation.

125
00:08:42,000 --> 00:08:46,000
Okay, so we have run this script and our output is saved in run train folder.

126
00:08:46,000 --> 00:08:54,000
So if we go to the over here runs detect train folder, here is our output video test one dot mp4.

127
00:08:54,000 --> 00:08:59,000
So I've already displayed this output video over here, so I am not running this cell over here, but

128
00:08:59,000 --> 00:09:00,000
it will take time.

129
00:09:00,000 --> 00:09:06,000
So I've already displayed this output video over here, so we just need to go here and copy path and

130
00:09:06,000 --> 00:09:07,000
just paste this over here.

131
00:09:07,000 --> 00:09:11,000
And when we run this cell, this output video will be displayed over here.

132
00:09:11,000 --> 00:09:16,000
So let me download this video and show you what results do actually we get.

133
00:09:16,000 --> 00:09:17,000
Okay.

134
00:09:19,000 --> 00:09:26,000
So let me just play this video and let me just navigate my screen towards this output video.

135
00:09:26,000 --> 00:09:26,000
Okay.

136
00:09:27,000 --> 00:09:30,000
So you can see over here we have the.

137
00:09:32,000 --> 00:09:37,000
Or because counting you can see over here the vehicles going in the north direction are the vehicles

138
00:09:37,000 --> 00:09:39,000
entering and the vehicles going in the south direction.

139
00:09:39,000 --> 00:09:40,000
Are the vehicles leaving?

140
00:09:40,000 --> 00:09:41,000
Okay.

141
00:09:41,000 --> 00:09:43,000
Plus, you can also see over here.

142
00:09:45,000 --> 00:09:45,000
Okay.

143
00:09:45,000 --> 00:09:47,000
So let me just go here.

144
00:09:47,000 --> 00:09:48,000
Let me do it a bit more.

145
00:09:48,000 --> 00:09:49,000
Okay.

146
00:09:49,000 --> 00:09:51,000
So let me just stop it over here.

147
00:09:51,000 --> 00:09:57,000
So now you can see that we have the vehicles counting and speed estimation as demanded as well.

148
00:09:57,000 --> 00:09:59,000
And we can see the speed estimation over here.

149
00:09:59,000 --> 00:10:02,000
Plus, next, we have the vehicles counting code over here as well.

150
00:10:02,000 --> 00:10:07,000
So because going into this direction, are the vehicles entering and the vehicles going in this direction,

151
00:10:07,000 --> 00:10:08,000
are the vehicles leaving?

152
00:10:08,000 --> 00:10:13,000
So we can simply say that the vehicles going in the north direction are the vehicles entering and the

153
00:10:13,000 --> 00:10:15,000
vehicles going in the south direction?

154
00:10:15,000 --> 00:10:16,000
Are the vehicles leaving?

155
00:10:16,000 --> 00:10:20,000
Plus, we can have also integrated object tracking with YOLO V8 segmentation.

156
00:10:20,000 --> 00:10:29,000
So you can see that we have assigned a unique ID to each of the detected object like 145 164 153 139

157
00:10:29,000 --> 00:10:32,000
137 plus we have also drawn the trails as well.

158
00:10:32,000 --> 00:10:33,000
Like you can see these trails.

159
00:10:33,000 --> 00:10:38,000
So these trails basically show that what path the object has followed.

160
00:10:38,000 --> 00:10:43,000
So you can we can say that the object is following this path, like coming from here and just going

161
00:10:43,000 --> 00:10:43,000
over here.

162
00:10:43,000 --> 00:10:49,000
So now what we have done is we have assigned a unique ID to each of the detected object, plus we have

163
00:10:49,000 --> 00:10:53,000
done the speed estimation as well, Plus we have done the vehicles counting.

164
00:10:53,000 --> 00:10:56,000
We have the total count and the sub count of the cars truck.

165
00:10:56,000 --> 00:11:01,000
And here we have also the total count 16 and the sub count of cars and trucks as well.

166
00:11:01,000 --> 00:11:07,000
So if we play this video from start, you can see that when the vehicle crosses this line.

167
00:11:08,000 --> 00:11:11,000
We have the account crosses this line.

168
00:11:11,000 --> 00:11:12,000
We have the vehicles entering count.

169
00:11:12,000 --> 00:11:16,000
And when the vehicles crosses this line, we have the vehicles leaving count.

170
00:11:16,000 --> 00:11:17,000
Okay.

171
00:11:17,000 --> 00:11:19,000
You can see over here.

172
00:11:19,000 --> 00:11:20,000
Okay, That's cool.

173
00:11:21,000 --> 00:11:24,000
So it's working quite fine.

174
00:11:24,000 --> 00:11:26,000
Let me explain you one thing over here.

175
00:11:28,000 --> 00:11:28,000
Okay.

176
00:11:28,000 --> 00:11:34,000
I'm just trying to post a video, so let me just explain this one thing over here.

177
00:11:36,000 --> 00:11:36,000
Okay.

178
00:11:36,000 --> 00:11:38,000
I'm just looking for a perfect example.

179
00:11:38,000 --> 00:11:39,000
Just.

180
00:11:39,000 --> 00:11:40,000
Just give me a minute.

181
00:11:43,000 --> 00:11:44,000
Okay.

182
00:11:44,000 --> 00:11:46,000
So that is the what I'm trying to explain.

183
00:11:46,000 --> 00:11:51,000
So you can see that these two other trails, when the trails intersect with this green line, which

184
00:11:51,000 --> 00:11:55,000
have a manually drawn, we can see the increment in the account, like the total count.

185
00:11:55,000 --> 00:11:59,000
And if it is a car, we can see the increment in the cars count as well.

186
00:11:59,000 --> 00:12:05,000
So what we are doing is that when these trails intersect with this white line, then we see the increment

187
00:12:05,000 --> 00:12:08,000
in the total count and in the cars count as well.

188
00:12:08,000 --> 00:12:14,000
Okay, So important thing is that like when this trails like this brown line over here, when this trail

189
00:12:14,000 --> 00:12:21,000
will intersect with slight green line, then we can see the increment in the count of the vehicles leaving

190
00:12:21,000 --> 00:12:22,000
and the sub count.

191
00:12:22,000 --> 00:12:25,000
If it is a truck, we will see the increment the truck count as well.

192
00:12:25,000 --> 00:12:26,000
Okay.

193
00:12:26,000 --> 00:12:28,000
So this is currently a green line.

194
00:12:28,000 --> 00:12:33,000
When the these trails intersect with this line, this green line turns white.

195
00:12:33,000 --> 00:12:33,000
Okay.

196
00:12:34,000 --> 00:12:39,000
So you can see that originally it's a green line, but when the trails intersect with this line, this

197
00:12:39,000 --> 00:12:41,000
line turns white.

198
00:12:41,000 --> 00:12:45,000
Okay, So I'm just checking if there is any other pattern.

199
00:12:46,000 --> 00:12:46,000
Okay.

200
00:12:48,000 --> 00:12:54,000
So that you can see that currently a green light when this trail intersects with this line, this turns

201
00:12:54,000 --> 00:12:55,000
into white.

202
00:12:55,000 --> 00:12:55,000
Okay.

203
00:12:55,000 --> 00:13:00,000
So similarly, if the trail is coming from here, intersect with this line, this line will turn white

204
00:13:00,000 --> 00:13:03,000
and we will see the increment in the total count of the vehicles leaving.

205
00:13:03,000 --> 00:13:04,000
And here is the sub count as well.

206
00:13:06,000 --> 00:13:07,000
Okay.

207
00:13:07,000 --> 00:13:12,000
So in the similar way you can test it on another demo videos as well, have just test it on this output

208
00:13:12,000 --> 00:13:13,000
demo video as well.

209
00:13:13,000 --> 00:13:15,000
And we can see the count over here as well.

210
00:13:17,000 --> 00:13:18,000
Okay.

211
00:13:18,000 --> 00:13:19,000
So.

212
00:13:20,000 --> 00:13:20,000
Okay.

213
00:13:20,000 --> 00:13:22,000
So this is all.

214
00:13:22,000 --> 00:13:26,000
Let me explain you the predict.py file and then we can end this video tutorial as well.

215
00:13:26,000 --> 00:13:33,000
So in the predict.py file I have integrated object tracking with YOLO V8 segmentation plus I have added

216
00:13:33,000 --> 00:13:39,000
the vehicles counting and the speed estimation code in the predict.py file as well over here in the

217
00:13:39,000 --> 00:13:42,000
first step as implementing object tracking using deepsort.

218
00:13:42,000 --> 00:13:45,000
So I'm just importing the deepsort modules in this.

219
00:13:47,000 --> 00:13:48,000
Predict Pyscript.

220
00:13:48,000 --> 00:13:49,000
Okay.

221
00:13:49,000 --> 00:13:52,000
And here I'm just initializing the Deepsort tracker.

222
00:13:52,000 --> 00:13:57,000
Then here I've created two dictionaries object counter one and object counter in the object counter

223
00:13:57,000 --> 00:14:03,000
one will store the count of the vehicles entering and the object counter will store the count of the

224
00:14:03,000 --> 00:14:04,000
vehicles leaving.

225
00:14:04,000 --> 00:14:10,000
And in the count up I will store the total count of the vehicles entering and the count down.

226
00:14:10,000 --> 00:14:15,000
I will store the total count of the vehicles leaving and in the object counter one dictionary will store

227
00:14:15,000 --> 00:14:22,000
the sub count like the cars, trucks and buses, count of the vehicles entering and the object counter

228
00:14:22,000 --> 00:14:25,000
will store the sub count of the cars, trucks and buses leaving.

229
00:14:25,000 --> 00:14:26,000
Okay.

230
00:14:26,000 --> 00:14:32,000
And here I've initialized the Deepsort tracker over here and here I'm just converting the output received

231
00:14:32,000 --> 00:14:39,000
from the YOLO V8 segmentation into a format that is compatible with YOLO V8 and visual that is compatible

232
00:14:39,000 --> 00:14:41,000
with Deepsort object tracking.

233
00:14:41,000 --> 00:14:46,000
So here I'm converting the output to see from the YOLO V8 segmentation to a format that is compatible

234
00:14:46,000 --> 00:14:51,000
with Deepsort object tracking and don't need this function currently in this project.

235
00:14:51,000 --> 00:14:57,000
I have also explained the complete color from labels in the previous videos and here I'm just creating

236
00:14:57,000 --> 00:15:03,000
a checkbox function to draw the rectangles around the detected object or the bounding boxes around the

237
00:15:03,000 --> 00:15:03,000
detected object.

238
00:15:03,000 --> 00:15:07,000
You can see that I'm using Cv2 dot rectangle over here.

239
00:15:07,000 --> 00:15:12,000
I'm drawing the bounding boxes around the detected object and using this cv2 dot rectangle, I'm creating

240
00:15:12,000 --> 00:15:18,000
a rectangle above the bounding box to put the text of the label and the unique ID as well.

241
00:15:18,000 --> 00:15:24,000
And here I've just created a function estimates period to do the speed estimation in to calculate the

242
00:15:24,000 --> 00:15:30,000
distance in pixels per stamp, calculating the distance in pixels to calculate the distance in pixel.

243
00:15:30,000 --> 00:15:32,000
I'm using the gradient distance partner.

244
00:15:32,000 --> 00:15:34,000
This is the gradient distance formula.

245
00:15:34,000 --> 00:15:40,000
After calculating the distance pixel, I am creating the distance in meter by dividing the distance

246
00:15:40,000 --> 00:15:42,000
pixel over pixel per meter.

247
00:15:42,000 --> 00:15:47,000
And here I've set the pixel parameter value as eight so you can make it dynamic as well.

248
00:15:47,000 --> 00:15:49,000
Closer to camera one and away from camera 20.

249
00:15:49,000 --> 00:15:53,000
So this way you can set it dynamic and here we have the time constraint.

250
00:15:53,000 --> 00:15:54,000
This is a constraint.

251
00:15:54,000 --> 00:16:00,000
You can adjust this time constraint as per the to get or you can fine tune this time to set to get more

252
00:16:00,000 --> 00:16:01,000
better results.

253
00:16:02,000 --> 00:16:05,000
And if you go here speed formula.

254
00:16:08,000 --> 00:16:08,000
Okay.

255
00:16:08,000 --> 00:16:13,000
So basically we have speed is equal to distance divided by time, but here we are doing distance multiply

256
00:16:13,000 --> 00:16:17,000
time constraint because this is a frequency, this is not time.

257
00:16:17,000 --> 00:16:23,000
So if we see that frequency is equal to one by time, okay, one by one divided by time.

258
00:16:23,000 --> 00:16:27,000
So here we are doing speed is equal to distance by multiply by frequency.

259
00:16:27,000 --> 00:16:27,000
Okay?

260
00:16:27,000 --> 00:16:34,000
And here we are getting the speed and to find the intersection between the trails and the manually drawn

261
00:16:34,000 --> 00:16:39,000
line, we are just creating the function intersect over here and here we have the function get track

262
00:16:39,000 --> 00:16:42,000
direction to calculate the vehicles in moving in the north direction.

263
00:16:42,000 --> 00:16:45,000
Then we will do the vehicles count of vehicles entering.

264
00:16:45,000 --> 00:16:50,000
If the vehicles is moving in the south direction, then we will do the count of the vehicles leaving.

265
00:16:50,000 --> 00:16:50,000
Okay.

266
00:16:50,000 --> 00:16:55,000
And will be just calling this function estimate speed over here to calculate the speed.

267
00:16:55,000 --> 00:17:00,000
And here I'm just calling the function get direction to calculate the direction if the vehicles are

268
00:17:00,000 --> 00:17:03,000
moving in the north direction or the south direction.

269
00:17:03,000 --> 00:17:09,000
Over here I am just moving a bit rapidly because in the YOLO object tracking I have already explained

270
00:17:09,000 --> 00:17:12,000
this code step by step, so I'm just moving fast.

271
00:17:12,000 --> 00:17:18,000
If you don't understand the sport, just go back to the YOLO V8, the Deepsort object tracking lecture

272
00:17:18,000 --> 00:17:19,000
and to understand this code.

273
00:17:19,000 --> 00:17:24,000
That's why I'm just moving fast over here in the YOLO V8 segmentation with Deepsort object tracking.

274
00:17:26,000 --> 00:17:26,000
Okay.

275
00:17:26,000 --> 00:17:30,000
And if they here we are doing the vehicles, count of the vehicles going the south direction, which

276
00:17:30,000 --> 00:17:32,000
is the vehicles leaving, leaving.

277
00:17:32,000 --> 00:17:36,000
And here we are doing the count of the vehicles going in the north direction, which is the vehicles

278
00:17:36,000 --> 00:17:38,000
entering over here.

279
00:17:38,000 --> 00:17:44,000
And I am just displaying the count of vehicles entering and the count of vehicles leaving in the UI.

280
00:17:44,000 --> 00:17:47,000
So that's all from this video tutorial.

281
00:17:47,000 --> 00:17:49,000
I hope you have learned from this video tutorial.

282
00:17:49,000 --> 00:17:50,000
See you all in the next video tutorial.

283
00:17:50,000 --> 00:17:52,000
Till then, bye bye.

