1
00:00:02,470 --> 00:00:09,730
This tutorial, we will cover how we can do object detection on images, videos and on the live webcam

2
00:00:09,730 --> 00:00:11,770
feed using YOLO v nine.

3
00:00:11,890 --> 00:00:18,310
So over here you can see that in my PyCharm Community Edition, I have created a new project by the

4
00:00:18,310 --> 00:00:22,420
name Yolo v nine flask Web app in my local app directory.

5
00:00:22,510 --> 00:00:27,730
You can create this project in any of your directory as well and you can find see over here I'm using

6
00:00:27,730 --> 00:00:29,620
Python 3.10.

7
00:00:30,310 --> 00:00:30,730
Okay.

8
00:00:30,730 --> 00:00:35,170
So the first step we will do on the YOLO v nine GitHub repo over here.

9
00:00:35,170 --> 00:00:39,700
So now you can see this is the YOLO v nine official GitHub repository.

10
00:00:39,700 --> 00:00:43,960
I will just click over here and copy URL to clipboard.

11
00:00:43,960 --> 00:00:47,950
And I will go back to PyCharm edition.

12
00:00:47,950 --> 00:00:54,910
And over here in the terminal I will just write it long and I will just paste the link of the YOLO v

13
00:00:54,910 --> 00:00:59,770
nine GitHub repository, which I have copied the I have copied the URL over here.

14
00:00:59,890 --> 00:01:05,020
So now you can see over here I'm cloning the YOLO v nine GitHub repository over here.

15
00:01:05,020 --> 00:01:07,090
And you can find this.

16
00:01:07,090 --> 00:01:11,830
So now you can see we have this YOLO nine uh GitHub repository over here.

17
00:01:11,830 --> 00:01:14,830
So I will just set this YOLO v nine as my current directory.

18
00:01:14,830 --> 00:01:17,890
So I will just write CD yolo v nine.

19
00:01:17,890 --> 00:01:21,490
And I'm just set this up as my current directory.

20
00:01:21,490 --> 00:01:23,170
Now this clone folder.

21
00:01:23,170 --> 00:01:29,710
So now I will just install all the required packages that I have added done in the requirements.txt

22
00:01:29,710 --> 00:01:29,950
file.

23
00:01:29,950 --> 00:01:35,050
So in the requirements or txt file you will find all the packages or the libraries that are required

24
00:01:35,050 --> 00:01:41,830
to do object detection or images or videos, or all the packages that are required to run the detection

25
00:01:41,830 --> 00:01:42,370
script.

26
00:01:43,560 --> 00:01:49,980
So you can install all these packages one by one or by the easy most easiest way is to write install.

27
00:01:50,770 --> 00:01:54,070
Minus R requirement.

28
00:01:54,160 --> 00:01:56,350
Or you can say this is height one r.

29
00:01:56,770 --> 00:01:58,750
So R basically stands for recursive.

30
00:01:58,750 --> 00:02:05,050
So this will install all the packages that are uh or the libraries that are written in the requirements

31
00:02:05,050 --> 00:02:05,260
dot.

32
00:02:05,290 --> 00:02:06,130
TXT file.

33
00:02:06,130 --> 00:02:06,850
So.

34
00:02:08,160 --> 00:02:14,940
You just need to write pip install r requirements.txt txt and you can see over here all the required

35
00:02:14,940 --> 00:02:16,980
packages are being getting stored.

36
00:02:22,140 --> 00:02:25,200
It's always recommended to create a virtual environment.

37
00:02:25,380 --> 00:02:30,000
In the previous lectures, I've told you how you can create your own, uh, create a virtual environment.

38
00:02:30,210 --> 00:02:34,830
Uh, I'm not creating a virtual environment over here, but it's recommended that you create a virtual

39
00:02:34,830 --> 00:02:36,870
environment, and it's good as well.

40
00:02:40,050 --> 00:02:45,360
So these packages translation will take some time like this will take few more minutes.

41
00:02:45,360 --> 00:02:49,380
So let's wait for all these packages to get installed and then we'll go ahead.

42
00:02:53,930 --> 00:02:56,060
But while this packages gets installed.

43
00:02:56,060 --> 00:03:00,050
So now you can see over here on these packages are being installed.

44
00:03:00,050 --> 00:03:03,080
Like you can see the installation of these packages have been finished.

45
00:03:03,080 --> 00:03:06,620
So while these packages get installed I have done two things.

46
00:03:06,620 --> 00:03:12,140
First, I have just created a resources folder over here in this resources folder I've added some sample

47
00:03:12,140 --> 00:03:13,610
images and videos.

48
00:03:13,610 --> 00:03:16,940
You can see over here I've added four different images and two videos.

49
00:03:17,930 --> 00:03:21,920
Along with this, I have just created another directory over here by the name weights.

50
00:03:21,920 --> 00:03:25,910
And here inside this I have added any model weights.

51
00:03:26,560 --> 00:03:29,920
So I'm using a yellow benign compact model weight okay.

52
00:03:29,920 --> 00:03:31,090
Which I've added over here.

53
00:03:31,090 --> 00:03:35,200
So let's see how we can do object detection or image and video.

54
00:03:35,200 --> 00:03:42,550
So to do object detection or image video or on the live webcam feed using Yolov3 using detect-you.py

55
00:03:42,550 --> 00:03:43,540
script over here.

56
00:03:43,540 --> 00:03:48,820
So I will just write python detect-your.py.

57
00:03:49,180 --> 00:03:57,700
And here in the source I will just pass uh, the, the source like, uh, source path over here, whether

58
00:03:57,700 --> 00:04:00,700
I want to do object detection on image or on video.

59
00:04:01,060 --> 00:04:07,690
So what I will do over here is I will just go to a serious sources directory.

60
00:04:07,690 --> 00:04:12,700
And over here I will just write over here image one dot jpg.

61
00:04:12,760 --> 00:04:18,040
So first I will show you how you can do object detection on this sample image.

62
00:04:19,400 --> 00:04:22,700
And I would just add that weird spot over here as well.

63
00:04:22,700 --> 00:04:27,530
So we'll just go to the weird folder which we can find over here.

64
00:04:27,710 --> 00:04:28,250
Okay.

65
00:04:28,250 --> 00:04:34,370
And in the weights folder I will just write your will like that.

66
00:04:34,370 --> 00:04:35,990
See the heart.

67
00:04:38,370 --> 00:04:41,250
But yes, all that's done over here.

68
00:04:41,760 --> 00:04:42,240
Okay.

69
00:04:42,780 --> 00:04:44,460
Let's click on enter.

70
00:04:44,460 --> 00:04:47,790
So now we are doing object detection on this sample image.

71
00:04:47,790 --> 00:04:51,420
Later on I will show you how we can do object detection on a video as well.

72
00:04:51,930 --> 00:04:53,730
So let's see how does it work.

73
00:04:53,730 --> 00:04:59,910
I am using CPU, I am don't have GPU in my local computer so the processing will be very slow.

74
00:05:02,860 --> 00:05:06,160
Or this will take a few seconds before it's been done.

75
00:05:18,220 --> 00:05:22,330
Well, you can see over here I have done object detection on this input image.

76
00:05:22,330 --> 00:05:25,090
And our output image is being saved over here.

77
00:05:25,390 --> 00:05:27,040
Image one dot jpg.

78
00:05:27,190 --> 00:05:27,820
Okay.

79
00:05:27,820 --> 00:05:34,060
So now you can see over here I am able to type this person okay dog as well.

80
00:05:34,060 --> 00:05:38,740
Plus you can see this is being detected as the backpack over here as well.

81
00:05:38,740 --> 00:05:41,500
So we have done detection on this input image.

82
00:05:41,500 --> 00:05:48,010
In the same way we can do object detection on this on an output or an input video as well.

83
00:05:48,010 --> 00:05:49,030
So.

84
00:05:50,330 --> 00:05:53,330
To do object detection on video.

85
00:05:53,360 --> 00:05:56,270
I'm just checking one thing over here.

86
00:05:58,530 --> 00:06:02,250
So I will just add the part.

87
00:06:02,250 --> 00:06:04,020
So I will just write over here.

88
00:06:04,560 --> 00:06:08,970
I want to do object detection on video one dot mp4.

89
00:06:09,770 --> 00:06:10,760
Last.

90
00:06:11,300 --> 00:06:14,300
I want to see the output as well.

91
00:06:14,300 --> 00:06:16,730
So I will just write view dash image.

92
00:06:17,320 --> 00:06:18,820
And let's get started with it.

93
00:06:18,820 --> 00:06:23,500
So now you can see over here I'm using YOLO v9 compact model weights.

94
00:06:23,500 --> 00:06:28,690
And I'm trying to do object detection on this input video video one dot mp4.

95
00:06:29,230 --> 00:06:31,960
So let's see what results do we get.

96
00:06:31,960 --> 00:06:38,290
And if we want to do object detection on the live webcam feed, you can simply set source to zero and

97
00:06:38,290 --> 00:06:41,860
you will be able to do object detection on the live webcam feed as well.

98
00:06:45,130 --> 00:06:45,490
It.

99
00:06:45,490 --> 00:06:46,870
Let's open this up.

100
00:06:50,100 --> 00:06:52,050
So now you can see over there.

101
00:06:52,380 --> 00:06:54,000
Uh, we are able to detect the cars.

102
00:06:54,030 --> 00:06:55,890
Now, these are not correct detection.

103
00:06:55,890 --> 00:06:57,120
These are not the cars.

104
00:06:57,120 --> 00:06:58,560
But this is not a truck.

105
00:06:58,560 --> 00:06:59,460
This is a boat.

106
00:06:59,460 --> 00:07:00,810
Uh, this is wrong detection.

107
00:07:00,810 --> 00:07:03,930
But you can see over here we are able to detect this car as well.

108
00:07:04,170 --> 00:07:04,590
Car?

109
00:07:04,590 --> 00:07:09,390
And as I told you, I am running it on CPU, so the processing is very slow.

110
00:07:09,720 --> 00:07:15,000
Okay, but if you have a good GPU and Nvidia GPU available in your local computer, uh, the processing

111
00:07:15,000 --> 00:07:18,390
will be very fast and we will be getting a very good frame rate as well.

112
00:07:18,390 --> 00:07:25,170
Like I am just getting a very low frame rate, but if you test it on, uh, good ship, you idiot,

113
00:07:25,170 --> 00:07:27,180
ship you 4060.

114
00:07:27,180 --> 00:07:32,850
So you will be getting around 10 to 11 frame rate as well as you can see.

115
00:07:33,420 --> 00:07:38,130
So now you can see that, uh, we are able to detect different cars in this image.

116
00:07:38,130 --> 00:07:44,490
And this is the wrong picture in the same way, uh, you can test it on any other, uh, video as well.

117
00:07:44,640 --> 00:07:48,900
And to do object detection on the live webcam feed, you can just need to do one thing.

118
00:07:48,900 --> 00:07:53,070
You just need to, uh, replace this source path with zero.

119
00:07:53,100 --> 00:07:55,410
Like, let me show you how this works.

120
00:07:55,410 --> 00:07:59,850
So, and you will be able to do object detection on the live webcam feed as well.

121
00:08:03,860 --> 00:08:07,880
So this might take a few more seconds before it gets executed.

122
00:08:27,380 --> 00:08:27,800
Book.

123
00:08:32,260 --> 00:08:36,460
So now you can see over here I'm able to do object detection on the live webcam feed.

124
00:08:36,460 --> 00:08:38,560
And you can see my face over here.

125
00:08:38,560 --> 00:08:40,930
And our results are very promising.

126
00:08:40,930 --> 00:08:42,400
Like this is the wrong direction.

127
00:08:42,400 --> 00:08:44,050
This is not a chair, this is a bear.

128
00:08:44,200 --> 00:08:49,300
But I am a person and it has corrected me as a person, so that's good.

129
00:08:49,300 --> 00:08:53,080
So in this way you can do object detection on the live webcam feed as well.

130
00:08:53,380 --> 00:08:53,830
Okay.

131
00:08:53,830 --> 00:09:00,310
So um, as you know that the main aim in this section is that we need to create a web app and we will

132
00:09:00,310 --> 00:09:02,620
be integrating yolo v9 with flask.

133
00:09:02,620 --> 00:09:10,300
So I have created a new.py file and I have adjusted that uh, script object detection script as per

134
00:09:10,300 --> 00:09:17,200
our requirements that we need to go uh, in the further we need to, uh, integrate YOLO benign with

135
00:09:17,200 --> 00:09:17,560
plaques.

136
00:09:17,560 --> 00:09:24,520
So I made some changes into this code and re rewritten this, uh, complete code and, uh, so that,

137
00:09:24,520 --> 00:09:28,780
uh, it would be easy for us to integrate the YOLO v9 object detection model with flask.

138
00:09:28,780 --> 00:09:31,330
So I will not be writing that complete code over here.

139
00:09:31,330 --> 00:09:33,250
So I will just show you that script file.

140
00:09:33,250 --> 00:09:34,960
So let me just add it over here.

141
00:09:38,080 --> 00:09:42,940
Over here you can see that I've created another.py file script file detection.py file.

142
00:09:42,940 --> 00:09:48,970
And I have just made few changes into this code and adjusted it as per our requirements, so that we

143
00:09:48,970 --> 00:09:51,250
can integrate your V9 with flask.

144
00:09:51,400 --> 00:09:56,590
Over here you can see that if I just go below down, I have created a function by the name object detection.

145
00:09:56,590 --> 00:10:03,130
And I have added all the object detection code over here so that we can do object detection with yolo

146
00:10:03,130 --> 00:10:03,940
v9.

147
00:10:04,150 --> 00:10:05,080
Okay.

148
00:10:05,080 --> 00:10:09,610
And plus you can see that um, I have just created a dictionary over here.

149
00:10:09,610 --> 00:10:15,670
And for example, uh, like if you want to do or use another model weights, like if you want to use

150
00:10:15,670 --> 00:10:21,250
any other YOLO model weights like you know that YOLO v9 come with, uh, let me show you.

151
00:10:21,970 --> 00:10:27,700
Well, for different models like compact, extended, medium, small, and if you have a good GPU available

152
00:10:27,700 --> 00:10:31,780
in your local computer, you can use your the V9 extended model weights as well.

153
00:10:31,780 --> 00:10:38,710
So yolo v9 extended model weights uh, or yolo v9 extended outperforms all the other YOLO v9 models

154
00:10:38,710 --> 00:10:39,430
as well.

155
00:10:39,430 --> 00:10:42,520
So currently I'm using YOLO v9 compact model weights.

156
00:10:42,520 --> 00:10:45,340
But if you want you can use this model weights as well.

157
00:10:45,340 --> 00:10:48,790
So like in this way you can vary different parameters.

158
00:10:48,790 --> 00:10:52,270
You can change the confidence threshold IOU threshold as well.

159
00:10:52,390 --> 00:10:58,510
Uh, if you don't want to do object detection on all the classes, you can select any specific class

160
00:10:58,510 --> 00:10:58,870
as well.

161
00:10:58,870 --> 00:11:01,330
Like if I want to detect only bicycle cars.

162
00:11:01,330 --> 00:11:03,190
So you can add the class over over here.

163
00:11:03,190 --> 00:11:06,280
And if you have a good GPU you can write device zero.

164
00:11:06,280 --> 00:11:09,940
I am currently running it on my CPU, so I have ten device CPU.

165
00:11:09,940 --> 00:11:15,550
And if you uh, maximum detection means like how many, uh, maximum number of predictions that you

166
00:11:15,550 --> 00:11:18,370
want to do in an image or a video frame.

167
00:11:18,520 --> 00:11:19,180
Okay.

168
00:11:20,150 --> 00:11:23,030
So this is all what you have over here, okay.

169
00:11:23,030 --> 00:11:25,970
And if you want to vary the image size you can do it over here.

170
00:11:25,970 --> 00:11:30,230
So you can adjust these parameters as well as per your requirements.

171
00:11:30,230 --> 00:11:36,080
And uh for now you can see you will see that uh I'm using yolo v9 pre-trained model weights.

172
00:11:36,080 --> 00:11:39,140
So YOLO v9 has been trained on the Coco data set.

173
00:11:39,140 --> 00:11:42,050
And Coco dataset consists of 80 different classes.

174
00:11:42,050 --> 00:11:44,480
So I've added all the class names over here.

175
00:11:44,480 --> 00:11:51,020
And if you're using some fine tuned YOLO inland water weights, you can change this and add the custom

176
00:11:51,020 --> 00:11:52,790
class names over here as well.

177
00:11:52,790 --> 00:11:55,100
And here I've just created colored labels.

178
00:11:55,100 --> 00:12:01,520
So uh, like you can you know that in as benign model is being trained on the Coco data set.

179
00:12:01,520 --> 00:12:05,810
And um, in the first we have person, then we have bicycles.

180
00:12:05,810 --> 00:12:11,210
So if the class ID is zero, like if there is a person, then the bounding boxes will have the following

181
00:12:11,210 --> 00:12:11,480
color.

182
00:12:11,480 --> 00:12:17,210
And if the class ID is two, like if the uh car is detected, then the bounding boxes will have this

183
00:12:17,210 --> 00:12:17,630
color.

184
00:12:17,630 --> 00:12:23,120
And if, uh, class ID is five, like the bus is detected, then the bounding box will have this.color

185
00:12:23,120 --> 00:12:25,190
else on the bounding boxes.

186
00:12:25,190 --> 00:12:28,280
Uh, other than these classes will have this color.

187
00:12:29,710 --> 00:12:36,130
And here I have added all the code that we have in the text that I have added few made few changes like

188
00:12:36,130 --> 00:12:43,090
I have added uh, s okay, so uh, I have added, uh, I'm just uh, doing calculating the frame rate

189
00:12:43,090 --> 00:12:44,350
as well over here.

190
00:12:44,350 --> 00:12:46,720
Like you can see over here.

191
00:12:47,440 --> 00:12:49,300
Um, let me show you.

192
00:12:50,290 --> 00:12:54,460
So I hear I'm not getting that, uh, frame rate using traditional way.

193
00:12:54,460 --> 00:12:57,370
I've just, uh, get reading the frame rate over here?

194
00:12:57,640 --> 00:12:57,910
Yes.

195
00:12:57,910 --> 00:12:58,570
Over here.

196
00:12:58,570 --> 00:12:59,590
So.

197
00:13:00,900 --> 00:13:02,670
We have the frame rate camera here.

198
00:13:02,670 --> 00:13:06,420
I was looking at total number of detections in each of the frame or image.

199
00:13:06,420 --> 00:13:12,300
So we'll have that total number of detections in each uh uh, frame or image.

200
00:13:12,300 --> 00:13:13,080
You can say that.

201
00:13:13,080 --> 00:13:15,300
Plus we are also getting the frame rate.

202
00:13:15,300 --> 00:13:23,730
Or you can say last we will also be getting the uh frame number like uh frame count over here.

203
00:13:23,730 --> 00:13:25,710
Like, uh, in this frame.

204
00:13:25,860 --> 00:13:26,700
Uh, we are done.

205
00:13:26,880 --> 00:13:31,980
Uh, how many total frames we have and how many, uh, processing on how many frames have been done.

206
00:13:31,980 --> 00:13:33,060
So all this.

207
00:13:33,060 --> 00:13:38,670
So, uh, I have just created this object detection function, like you can see over here.

208
00:13:38,670 --> 00:13:41,940
And in the object detection function, we just need to pass one input.

209
00:13:41,940 --> 00:13:45,480
You can either pass the video path, you can pass the image path.

210
00:13:45,480 --> 00:13:50,370
Or if you want to do object detection using live webcam feed, you can just pass the path as zero.

211
00:13:50,370 --> 00:13:53,010
So let's get started with this with an image.

212
00:13:53,010 --> 00:13:56,430
So if I just go to the resources folder over here.

213
00:13:56,940 --> 00:14:01,560
So first I will just write image three okay.

214
00:14:02,220 --> 00:14:03,210
Right over here.

215
00:14:04,510 --> 00:14:06,370
Image three dot jpg.

216
00:14:06,520 --> 00:14:08,920
So first we will do object detection on this image.

217
00:14:08,920 --> 00:14:11,320
So I will just open terminal over here.

218
00:14:12,300 --> 00:14:13,320
In.

219
00:14:16,280 --> 00:14:19,250
So I will just write Python detection.py.

220
00:14:19,280 --> 00:14:22,130
So you just need to run this detection.py script file.

221
00:14:22,730 --> 00:14:26,510
And over here no other arguments are required.

222
00:14:39,700 --> 00:14:40,690
So let's see.

223
00:14:43,410 --> 00:14:43,770
Okay.

224
00:14:44,130 --> 00:14:45,510
Uh, we we get the results.

225
00:14:45,510 --> 00:14:50,850
So now you can see this is our output image or a variable.

226
00:14:52,830 --> 00:14:54,030
Okay, okay, okay.

227
00:14:55,110 --> 00:15:01,620
If you want to close the image so you can just set cv2 dot wait zero okay.

228
00:15:01,620 --> 00:15:04,050
As we can see the output image over here as well.

229
00:15:04,050 --> 00:15:06,930
But let me show you the output image over here.

230
00:15:08,190 --> 00:15:09,630
So I'm adding an infinite delay.

231
00:15:09,630 --> 00:15:13,140
So we'll have the output image being displayed over here.

232
00:15:13,680 --> 00:15:17,040
Previously there were one millisecond delay or one second.

233
00:15:23,400 --> 00:15:25,140
Well, let's see how does it works.

234
00:15:27,320 --> 00:15:30,800
And you can see here we have the our output image from the previous section.

235
00:15:38,350 --> 00:15:39,370
Okay.

236
00:15:43,770 --> 00:15:46,650
But this will take a few more seconds before we have.

237
00:15:47,160 --> 00:15:47,880
So now okay.

238
00:15:47,880 --> 00:15:48,360
That's it.

239
00:15:48,360 --> 00:15:51,540
So now you can see over here this is our output image.

240
00:15:51,780 --> 00:15:54,210
Uh, here you can see we have first person.

241
00:15:54,210 --> 00:15:56,070
So you can see this person is very far away.

242
00:15:56,070 --> 00:15:58,380
But our border has detected this person as well.

243
00:15:58,680 --> 00:16:02,370
Uh, traffic lights and bad, uh, bicycle.

244
00:16:02,370 --> 00:16:03,360
Everything is detected.

245
00:16:03,360 --> 00:16:05,220
So the results is very promising.

246
00:16:05,580 --> 00:16:11,460
Okay, so let me just do one, because we will be doing, uh, now object detection on video.

247
00:16:11,460 --> 00:16:17,730
So now I will just test on video to dot before and let's see what results do we get.

248
00:16:39,660 --> 00:16:45,450
But all over here you can see that, uh, we are doing object detection on this video as well.

249
00:16:45,780 --> 00:16:46,290
Okay.

250
00:16:46,290 --> 00:16:50,160
And you can see we are able to detect the person handbag, backpack.

251
00:16:50,160 --> 00:16:53,700
And you can see currently the frame rate is 0.28.

252
00:16:53,700 --> 00:16:56,580
Over here you can see that the frame rate is very low.

253
00:16:56,880 --> 00:16:57,300
Okay.

254
00:16:57,300 --> 00:17:01,050
And like if you test it on uh go Gpio.

255
00:17:01,050 --> 00:17:05,490
So the frame rate will be uh very high like it will be around 10 to 11.

256
00:17:05,490 --> 00:17:13,410
But currently the FPS frame per second like frame rate tells us how many frames are processed per second

257
00:17:13,410 --> 00:17:14,190
in a second.

258
00:17:14,190 --> 00:17:14,760
Okay.

259
00:17:23,060 --> 00:17:26,300
Now you can see we are able to detect different person and bags over here.

260
00:17:26,720 --> 00:17:30,770
So in this way you can see we have done object detection on a video as well.

261
00:17:30,770 --> 00:17:33,110
We have done object detection on the image as well.

262
00:17:33,110 --> 00:17:35,330
Plus two object detection on the live webcam feed.

263
00:17:35,330 --> 00:17:40,100
You can simply set this as zero and you will be able to do object detection on the live webcam feed

264
00:17:40,100 --> 00:17:40,700
as well.

265
00:17:40,700 --> 00:17:43,850
So one thing which I would do over here.

266
00:17:46,610 --> 00:17:47,570
So.

267
00:17:48,440 --> 00:17:50,870
Now we will be integrating your log line.

268
00:17:50,870 --> 00:17:53,990
So now currently you can see that we are doing object detection with YOLO v9.

269
00:17:54,020 --> 00:17:58,400
But now we will be integrating this YOLO v9 with uh flask.

270
00:17:58,400 --> 00:18:01,580
So I will just make a few changes over here.

271
00:18:02,970 --> 00:18:03,540
So.

272
00:18:07,250 --> 00:18:08,990
Exposed up as well.

273
00:18:09,920 --> 00:18:13,520
Uh, let's let's watch this as well.

274
00:18:15,980 --> 00:18:17,150
Okay.

275
00:18:18,410 --> 00:18:19,220
Okay, okay.

276
00:18:19,850 --> 00:18:20,900
And.

277
00:18:25,110 --> 00:18:25,350
We're.

278
00:18:33,230 --> 00:18:33,620
Okay.

279
00:18:34,130 --> 00:18:35,870
Plus R over here.

280
00:18:39,950 --> 00:18:40,700
Remote desktop.

281
00:18:41,780 --> 00:18:43,490
And here I will add unit keyword.

282
00:18:43,490 --> 00:18:45,080
So what is hidden keyword.

283
00:18:45,890 --> 00:18:51,230
So basically you'd go keyword allows the function to return multiple values.

284
00:18:51,230 --> 00:18:56,330
Like we will be uh getting the uh uh object detection on the current frame.

285
00:18:56,330 --> 00:18:59,030
Plus we will be returning the frame rate or FPS.

286
00:18:59,030 --> 00:19:00,590
Plus we will be in output.

287
00:19:00,590 --> 00:19:05,930
We'll be getting the current frame shape and in the output will also be getting the total number of

288
00:19:05,930 --> 00:19:09,200
rejections in each of the frame as well.

289
00:19:09,200 --> 00:19:12,800
So like we are getting multiple outputs from here.

290
00:19:12,800 --> 00:19:21,680
So uh, so here keyword uh yield keyword basically done as multiple uh values without terminating the

291
00:19:21,680 --> 00:19:22,790
complete process.

292
00:19:25,330 --> 00:19:28,600
So this all this makes us easy to process.

293
00:19:28,990 --> 00:19:32,920
Basically, this all makes it easy to process all the frames.

294
00:19:32,950 --> 00:19:33,550
Okay.

295
00:19:33,550 --> 00:19:37,720
And to to do iterations over each of the frame one by one.

296
00:19:37,720 --> 00:19:42,400
So I'll just write I am zero like this is my current frame.

297
00:19:43,030 --> 00:19:47,860
And the frame rate, the frame rate will give me the FPS value.

298
00:19:49,920 --> 00:19:51,150
A current frame shape.

299
00:19:52,380 --> 00:19:58,020
And the total number of detections, like how many different, uh, objects are detected in the current

300
00:19:58,020 --> 00:19:58,290
frame.

301
00:19:58,290 --> 00:19:59,850
Like I forgot to tell you.

302
00:19:59,850 --> 00:20:02,850
Like you can see over here, we get total number of detection.

303
00:20:02,880 --> 00:20:03,510
30.

304
00:20:03,510 --> 00:20:08,910
So this basically gives the detection count like how many different objects are detected in each of

305
00:20:08,910 --> 00:20:10,710
the frame like total detection 30.

306
00:20:11,160 --> 00:20:14,520
So all this up okay.

307
00:20:14,850 --> 00:20:20,610
So that's all what we are getting from here okay.

308
00:20:20,610 --> 00:20:27,870
So if you want me I can show you this as well like predictions.

309
00:20:29,010 --> 00:20:31,650
So let me just uncomment this up from here.

310
00:20:33,150 --> 00:20:36,000
Let me add zero okay.

311
00:20:36,000 --> 00:20:36,810
And.

312
00:20:41,460 --> 00:20:44,100
Let me show you the total number of this works.

313
00:20:44,430 --> 00:20:46,470
So if I just write over here.

314
00:20:50,620 --> 00:20:52,270
Image one.

315
00:20:54,340 --> 00:20:54,610
Dot.

316
00:20:59,920 --> 00:21:02,650
So let us see how this works.

317
00:21:18,640 --> 00:21:21,250
Why it's not working currently.

318
00:21:22,990 --> 00:21:23,500
It's.

319
00:21:23,500 --> 00:21:25,900
Image one dot jpg.

320
00:21:28,340 --> 00:21:30,230
But it was by point detection.

321
00:21:30,230 --> 00:21:30,980
Dot py.

322
00:21:33,050 --> 00:21:34,130
Okay let's see.

323
00:21:34,910 --> 00:21:36,680
Hopefully this will work now.

324
00:21:43,720 --> 00:21:44,290
Short word.

325
00:21:44,290 --> 00:21:45,670
Now let's see.

326
00:21:48,740 --> 00:21:49,340
Okay.

327
00:21:49,370 --> 00:21:49,580
Right.

328
00:21:50,450 --> 00:21:52,790
So I'll just make it out the keyword now.

329
00:21:53,450 --> 00:21:55,490
So let me show you.

330
00:21:57,590 --> 00:21:57,890
Okay.

331
00:21:57,890 --> 00:22:03,230
So now you can see we have the dog person handbag this car as well.

332
00:22:03,950 --> 00:22:04,280
Okay.

333
00:22:04,280 --> 00:22:06,170
So if I just press the one key.

334
00:22:06,290 --> 00:22:10,400
So now you can see that the total number of four detections and this is the frame rate.

335
00:22:10,400 --> 00:22:12,980
So if I just open this over here.

336
00:22:12,980 --> 00:22:14,780
So now you can see we have this card.

337
00:22:14,780 --> 00:22:19,220
This is the first detection this dog uh which is the second detection.

338
00:22:19,550 --> 00:22:22,670
So this is the car first two three.

339
00:22:22,670 --> 00:22:27,200
This is the person and this is the handbag in beside you can see, uh, this handbag.

340
00:22:27,200 --> 00:22:28,670
So this is the fourth detection.

341
00:22:28,670 --> 00:22:31,340
So we have it total four different objects.

342
00:22:31,340 --> 00:22:38,150
So we are getting the total detection count over here as well okay.

343
00:22:42,770 --> 00:22:50,780
So much for this benign object detection model as the current frame, the frame rate like the FPS.

344
00:22:50,810 --> 00:22:53,000
Currently you can see that this is very low.

345
00:22:53,000 --> 00:22:54,620
It's over minus ten.

346
00:22:54,620 --> 00:22:57,920
The frame size and total number of detections.

347
00:22:57,920 --> 00:23:00,470
Like currently we have detected four different objects.

348
00:23:00,470 --> 00:23:00,860
Okay.

349
00:23:00,860 --> 00:23:06,440
So the frame size will be I think uh like this will be a 1080 or so like this.

350
00:23:06,440 --> 00:23:08,060
Will the frame size what I see.

351
00:23:11,220 --> 00:23:13,260
So that's all from this tutorial.

352
00:23:13,260 --> 00:23:17,700
Uh, in the next tutorial we will see how we can integrate YOLO with flask.

353
00:23:17,880 --> 00:23:19,140
So let's go ahead.
