1
00:00:02,540 --> 00:00:06,770
The last tutorial we have seen that how we can integrate your V9 with flask.

2
00:00:06,770 --> 00:00:10,970
So now we will just go ahead and complete this complete web app.

3
00:00:11,210 --> 00:00:18,320
So before we go ahead, uh, in towards the HTML and CSS code, we need to, uh, complete this flask

4
00:00:18,320 --> 00:00:19,910
app.py file as well.

5
00:00:22,790 --> 00:00:29,000
So we will just, uh, import a few other libraries and we will, uh, create a flask form so that user

6
00:00:29,000 --> 00:00:32,300
can upload a file, whether it's image or a video file.

7
00:00:32,300 --> 00:00:34,040
So let's get started with it.

8
00:00:34,040 --> 00:00:36,470
And we need to install some packages as well.

9
00:00:41,310 --> 00:00:45,150
So I will just write from last the WDF.

10
00:00:47,020 --> 00:00:49,750
Or knobs on.

11
00:00:50,740 --> 00:00:51,400
Okay.

12
00:00:53,500 --> 00:00:58,780
So next I will just write WP forms.

13
00:01:01,380 --> 00:01:01,830
All.

14
00:01:12,860 --> 00:01:13,430
Doublet.

15
00:01:14,090 --> 00:01:14,450
The.

16
00:01:20,050 --> 00:01:23,230
And I will just report this as well.

17
00:01:40,730 --> 00:01:44,210
And we will just try to port from the forms.

18
00:01:45,330 --> 00:01:46,680
Dot validators.

19
00:01:46,710 --> 00:01:53,400
So, uh, to just make sure that the user uploads a video file and the user, uh, the file that the

20
00:01:53,400 --> 00:01:58,020
video file or image file that the user has uploaded is in the correct format.

21
00:02:01,760 --> 00:02:04,760
So this is the need for the validators.

22
00:02:07,040 --> 00:02:07,520
Okay.

23
00:02:07,520 --> 00:02:23,270
So now we'll just install this pip install uh wp forms loss wp f for I, uh, I desktop and I will just

24
00:02:23,270 --> 00:02:28,550
open uh, the requirements.txt file as well.

25
00:02:29,510 --> 00:02:31,880
Let me add all these packages over here.

26
00:02:41,940 --> 00:02:42,960
And.

27
00:02:42,960 --> 00:02:43,320
Okay.

28
00:02:43,320 --> 00:02:44,010
So.

29
00:02:46,170 --> 00:02:47,250
That looks lost.

30
00:02:47,550 --> 00:02:48,540
WTF?

31
00:02:52,790 --> 00:02:55,340
Well, I think these are quite packages.

32
00:02:55,370 --> 00:02:56,420
You have all this?

33
00:02:59,210 --> 00:03:06,080
So now we will use the task form to get the input file.

34
00:03:08,440 --> 00:03:10,600
But all the agents that.

35
00:03:13,120 --> 00:03:14,410
Oversight got lost.

36
00:03:14,410 --> 00:03:15,100
Upload.

37
00:03:17,370 --> 00:03:18,450
Rainfall.

38
00:03:38,370 --> 00:03:39,150
This type file.

39
00:03:40,050 --> 00:03:40,410
Okay.

40
00:03:40,410 --> 00:03:41,850
We have imported this library.

41
00:03:41,850 --> 00:03:43,140
I can see over here.

42
00:03:45,450 --> 00:03:48,510
And here we have the file that the user will upload.

43
00:03:51,830 --> 00:03:58,370
So the validators make sure that the user upload a file and the file is in the correct format, whether

44
00:03:58,370 --> 00:04:00,230
it's an image file or a video file.

45
00:04:03,590 --> 00:04:06,170
Input required, like validation validators.

46
00:04:06,170 --> 00:04:12,920
Make sure that before the processing begins that the user has uploaded an image or video file.

47
00:04:15,950 --> 00:04:17,540
Then we will have a subnet.

48
00:04:24,130 --> 00:04:28,150
So the user can upload up, uh, submit the input video or image file.

49
00:04:32,210 --> 00:04:32,690
Okay.

50
00:04:32,690 --> 00:04:38,810
And now you can see that in the detection.py file we are just getting the frame rate, the size of the

51
00:04:38,810 --> 00:04:40,820
current frame and total number of detections.

52
00:04:41,660 --> 00:04:41,870
Okay.

53
00:04:41,870 --> 00:04:45,050
So let's complete this up all over here as well.

54
00:05:29,220 --> 00:05:33,930
Paul will keep account of, uh, frame rate or frame per second as well.

55
00:05:33,930 --> 00:05:38,370
So for this we will just write over here is count.

56
00:05:38,370 --> 00:05:43,890
So we are just declaring it with lower bound so that the value can be accessed outside the function

57
00:05:44,130 --> 00:05:45,390
as well.

58
00:05:51,140 --> 00:05:53,780
So this is equal to string.

59
00:05:53,780 --> 00:05:58,580
And this would give us the frame rate will give us the count.

60
00:06:01,070 --> 00:06:01,820
And.

61
00:06:05,300 --> 00:06:08,060
Then we'll also have the frame size.

62
00:06:08,060 --> 00:06:12,770
And to assess this outside the desired frame size zero.

63
00:06:26,720 --> 00:06:30,770
And here we will dictate frame size.

64
00:06:30,950 --> 00:06:34,550
Here I will just take the first index here.

65
00:06:36,710 --> 00:06:38,180
Here we have paint shape.

66
00:06:40,940 --> 00:06:45,620
And now we will also, uh, keep the count of the total number of detected objects.

67
00:06:45,620 --> 00:06:52,880
So just detected objects, and we will just initialize detected objects.

68
00:06:52,880 --> 00:06:53,810
So here.

69
00:07:17,980 --> 00:07:18,550
Okay.

70
00:07:18,550 --> 00:07:19,420
And.

71
00:07:20,640 --> 00:07:23,640
Yeah, we would have protection.

72
00:07:35,290 --> 00:07:35,560
Okay.

73
00:07:38,950 --> 00:07:39,280
Okay.

74
00:07:39,280 --> 00:07:40,930
That's completely fine now.

75
00:07:45,620 --> 00:07:46,550
So blast!

76
00:07:46,550 --> 00:07:50,210
I'll change this URL reflections over here as well.

77
00:07:51,130 --> 00:07:54,130
And we will just create another thing.

78
00:07:54,130 --> 00:07:57,790
Airport road it.

79
00:07:58,390 --> 00:08:00,160
And over here.

80
00:08:01,180 --> 00:08:03,730
Why is it still the front page?

81
00:08:19,940 --> 00:08:22,340
All this will be the front page of our application.

82
00:08:27,080 --> 00:08:30,260
But first we will create an instance for this upload file form.

83
00:08:33,410 --> 00:08:38,750
So I'm just creating an instance of instance of this upload file form over here.

84
00:09:00,220 --> 00:09:06,490
But, uh, when the user uploads an image file or a video file, we'll try to get the file name from

85
00:09:06,490 --> 00:09:06,970
there.

86
00:09:09,070 --> 00:09:12,520
So first we'll just write your name.

87
00:09:17,360 --> 00:09:21,170
Well, I was awarded this library as well, so that's good.

88
00:09:24,490 --> 00:09:27,100
And it will try to get the file path.

89
00:09:41,000 --> 00:09:48,650
And after getting the file path will save that input file into this static files folder.

90
00:09:48,650 --> 00:09:50,900
So over here the input file will be saved.

91
00:10:15,650 --> 00:10:19,160
So we will just create a session storage over here as well.

92
00:10:26,030 --> 00:10:27,950
I will save the file path.

93
00:10:29,270 --> 00:10:29,750
Okay.

94
00:10:34,050 --> 00:10:34,230
He.

95
00:10:37,520 --> 00:10:45,290
So if the user uploads an input file and we have made sure that the user uploaded the file and it's

96
00:10:45,290 --> 00:10:50,300
in the correct format, then we will save the file into the static file folder.

97
00:10:50,300 --> 00:10:55,400
And in the session storage we will have the video path of the file.

98
00:10:55,400 --> 00:10:57,860
And then we will just render the template.

99
00:11:03,110 --> 00:11:04,850
I will just add a flash HTML file.

100
00:11:04,850 --> 00:11:07,190
I've already done the HTML css code.

101
00:11:11,750 --> 00:11:16,760
We have a great instance of the upload file form over here, so that's no worries.

102
00:11:18,680 --> 00:11:23,540
So if we are here that means that uploaded store the user has uploaded a file.

103
00:11:26,870 --> 00:11:28,760
And for file name we have.

104
00:11:32,760 --> 00:11:35,190
House band with the standard template.

105
00:11:39,700 --> 00:11:40,690
Swong.

106
00:11:40,690 --> 00:11:41,710
Uploaded.

107
00:11:43,930 --> 00:11:46,300
All rounds and the final.

108
00:11:50,540 --> 00:11:52,550
Okay, so that's completely great.

109
00:11:52,580 --> 00:11:55,550
Uh, we are just, uh, on our land from here.

110
00:11:56,450 --> 00:11:57,680
Okay, so.

111
00:12:00,680 --> 00:12:01,430
Well, okay.

112
00:12:04,220 --> 00:12:08,210
So now I will just add up all my HTML, CSS code.

113
00:12:11,910 --> 00:12:18,150
I will just go over here and create a new directory over here by the name templates.

114
00:12:19,680 --> 00:12:22,980
And inside this I will add my HTML file.

115
00:12:42,260 --> 00:12:44,660
But let me add that HTML file over here.

116
00:12:48,450 --> 00:12:51,210
Well, I went and restored each HTML file over here.

117
00:12:51,210 --> 00:12:59,070
Like, you can see all the HTML code over here and here in the static I have this CSS file Python file.

118
00:12:59,070 --> 00:12:59,430
Okay.

119
00:12:59,430 --> 00:13:02,760
And here is the logo which will be appearing in the web app.

120
00:13:02,760 --> 00:13:04,590
And this is the tablet image.

121
00:13:04,590 --> 00:13:11,070
Inside this I will just display my output image or video with the different objects being detected inside,

122
00:13:11,070 --> 00:13:11,940
uh, over them.

123
00:13:12,330 --> 00:13:12,870
Okay.

124
00:13:13,260 --> 00:13:18,180
So that's all, um, you can just keep this as HTML code.

125
00:13:18,180 --> 00:13:21,780
There is nothing, uh, very special about this HTML code.

126
00:13:21,780 --> 00:13:24,510
Uh, this is very simple HTML code.

127
00:13:24,990 --> 00:13:25,410
Okay.

128
00:13:25,410 --> 00:13:28,830
So let's run this up and see how this works.

129
00:13:36,040 --> 00:13:37,000
Yes, or.

130
00:13:42,010 --> 00:13:47,590
Uh, instead of this, uh, how we would have created this HTML, uh, file.

131
00:13:47,590 --> 00:13:50,770
So let me just show you an overview of this.

132
00:13:52,880 --> 00:13:55,520
And also there's not a very correct.

133
00:13:55,520 --> 00:14:04,940
I just make my songs last like let's first execute it and then I will explain you the SQL code as well.

134
00:14:09,090 --> 00:14:11,940
But before we run this, we need to complete our.

135
00:14:11,940 --> 00:14:13,290
We need to make few changes.

136
00:14:15,000 --> 00:14:16,470
We just forgot this.

137
00:14:16,500 --> 00:14:20,280
We need to add video path over here as well.

138
00:14:21,300 --> 00:14:25,770
And yeah, we'll try to get, uh, the video back from the session.

139
00:14:25,770 --> 00:14:26,460
Storage.

140
00:14:28,720 --> 00:14:33,430
Okay, so inside this session storage I have just saved my video path.

141
00:14:33,850 --> 00:14:34,240
Okay.

142
00:14:34,240 --> 00:14:36,190
So I will try to get it over here.

143
00:14:45,290 --> 00:14:47,750
So you are able to get the video part.

144
00:14:54,340 --> 00:14:59,200
And I would just say radio Bob and Alex.

145
00:15:01,290 --> 00:15:01,860
They're gone.

146
00:15:07,530 --> 00:15:09,810
Okay, so that's completely fine now.

147
00:15:17,290 --> 00:15:17,560
Okay.

148
00:15:17,560 --> 00:15:20,110
So let's see how does it works.

149
00:15:20,110 --> 00:15:24,460
Whether we are applet upload or able to upload an image file or video file.

150
00:15:24,790 --> 00:15:34,360
Well, instead of video path or record if it is right file path because we can upload an image or video.

151
00:15:42,370 --> 00:15:42,970
O-kin.

152
00:15:43,510 --> 00:15:46,150
Well, now it's it looks more.

153
00:15:47,440 --> 00:15:52,060
Okay, so so let's see how does it goes.

154
00:15:53,140 --> 00:15:54,040
Okay.

155
00:15:55,420 --> 00:15:58,780
And expression is not defined.

156
00:16:08,610 --> 00:16:10,680
Import this driver over here.

157
00:16:10,680 --> 00:16:10,890
And.

158
00:16:13,970 --> 00:16:14,120
Well.

159
00:16:14,120 --> 00:16:14,510
God's.

160
00:16:16,380 --> 00:16:17,850
Refresh the support here.

161
00:16:21,330 --> 00:16:23,940
And hopefully this issue will be fixed now.

162
00:16:34,740 --> 00:16:41,850
If so, let me upload an image file and if I just click on the play okay.

163
00:16:43,140 --> 00:16:44,640
We have an error.

164
00:16:47,800 --> 00:16:53,500
Edwards there in such joint spelling mistake.

165
00:16:56,590 --> 00:16:57,340
So let's see.

166
00:16:57,370 --> 00:16:57,940
Or does it.

167
00:16:57,940 --> 00:16:58,810
Cause now.

168
00:17:15,120 --> 00:17:17,520
Okay, so let me upload an image file over here.

169
00:17:23,830 --> 00:17:29,560
Um, I'm just, uh, trying to see the terminal with all the press.

170
00:17:31,750 --> 00:17:31,990
We.

171
00:17:31,990 --> 00:17:34,120
I hope we will be able to see some results now.

172
00:17:36,270 --> 00:17:38,040
Okay, so now you can say it's working.

173
00:17:38,040 --> 00:17:41,220
We are able to take this person's traffic lights over here.

174
00:17:41,640 --> 00:17:41,970
Okay.

175
00:17:41,970 --> 00:17:42,660
So that's good.

176
00:17:44,160 --> 00:17:44,490
Okay.

177
00:17:44,490 --> 00:17:46,230
So let's upload this video.

178
00:17:46,260 --> 00:17:47,010
Let's see.

179
00:17:47,070 --> 00:17:51,090
So all these icons are different world like all these icons.

180
00:17:51,090 --> 00:17:56,040
Uh, we can use these icons later on for different, uh, for different functions.

181
00:17:56,040 --> 00:17:58,530
But currently the first two icons are working well.

182
00:17:58,710 --> 00:18:00,450
This is the upload button icon.

183
00:18:00,450 --> 00:18:04,830
And this is the play button icon so that you can do object detection on image or video.

184
00:18:04,830 --> 00:18:06,780
From here you will upload an image file.

185
00:18:07,170 --> 00:18:11,490
So now you can see over here we are able to track different person handbag over here.

186
00:18:11,490 --> 00:18:16,530
In the same way you can uh do object detection on some other image or video as well.

187
00:18:17,190 --> 00:18:19,170
So previously you have tested on a video.

188
00:18:22,780 --> 00:18:23,050
Now.

189
00:18:28,330 --> 00:18:28,630
Okay.

190
00:18:28,630 --> 00:18:33,370
In the same way you can, uh, like you can see over here we have detected four different persons and

191
00:18:33,370 --> 00:18:35,230
one football in the same way.

192
00:18:35,320 --> 00:18:38,380
You can upload some other video over here as well.

193
00:18:47,460 --> 00:18:48,780
Like you can see over here.

194
00:18:48,780 --> 00:18:51,150
We are able to detect different cars over here.

195
00:18:51,150 --> 00:18:55,440
I'm testing on CPU, so the processing is very slow currently.

196
00:18:58,800 --> 00:18:59,370
Okay.

197
00:18:59,790 --> 00:19:03,540
So like you can see that there.

198
00:19:03,540 --> 00:19:05,550
The cars are moving over here.

199
00:19:06,150 --> 00:19:06,720
Okay.

200
00:19:06,720 --> 00:19:07,350
So.

201
00:19:11,390 --> 00:19:18,500
Less of one thing we can do is like, you can see that, uh, we are just getting the FPS count, frame

202
00:19:18,500 --> 00:19:20,030
size, total detected object.

203
00:19:23,830 --> 00:19:26,260
We cannot go right over here.

204
00:19:26,260 --> 00:19:27,580
App dot route.

205
00:19:30,800 --> 00:19:31,460
First.

206
00:19:33,500 --> 00:19:34,490
Methodist.

207
00:19:43,580 --> 00:19:48,350
We are just creating a URL by the name so that we can get the frame rate.

208
00:19:50,540 --> 00:19:54,740
Or know that we have created a global yes count.

209
00:19:55,130 --> 00:19:58,880
And inside this variable we have the our frame rate stored.

210
00:20:01,390 --> 00:20:01,720
Or.

211
00:20:03,370 --> 00:20:05,890
We need to import the library.

212
00:20:14,490 --> 00:20:17,820
And just go hard for this, I think as well.

213
00:20:41,940 --> 00:20:44,370
And now we have a plot for.

214
00:20:51,820 --> 00:20:54,730
Well, in the deacon we have the total number of detections out.

215
00:21:36,970 --> 00:21:38,860
And then we can also get the.

216
00:21:41,020 --> 00:21:42,580
Frame size as well.

217
00:22:23,860 --> 00:22:26,680
Okay, so we are done with all this up now.

218
00:22:29,210 --> 00:22:30,770
Lesson.i, you can say.

219
00:22:32,990 --> 00:22:36,560
We have made some changes in the code and debugging for the new changes.

220
00:23:16,490 --> 00:23:21,470
But now you can see that, um, the object detection is being downloaded this video and let's see if

221
00:23:21,470 --> 00:23:22,880
we are able to get the frame rate.

222
00:23:22,880 --> 00:23:26,150
So now you can see that the frame rate is 0.172.

223
00:23:26,390 --> 00:23:30,020
And let's see what is the total number detection score.

224
00:23:30,020 --> 00:23:36,140
So in this current frame we have six total detections count like six different jets are detected.

225
00:23:36,140 --> 00:23:38,210
And let's see what is the frame size.

226
00:23:38,210 --> 00:23:40,880
So the frame size is 1020 okay.

227
00:23:40,880 --> 00:23:42,650
So we can upload an image file.

228
00:23:42,650 --> 00:23:44,960
And let's see how does it work.

229
00:23:44,960 --> 00:23:45,680
So.

230
00:23:53,930 --> 00:23:59,210
So let's say in this case total number of detections.

231
00:23:59,210 --> 00:24:00,800
Now 22.

232
00:24:00,830 --> 00:24:01,880
Let's count this.

233
00:24:02,180 --> 00:24:08,090
So 123456789

234
00:24:08,090 --> 00:24:16,400
1011 1213 1415 1617 1821 1920 2122.

235
00:24:16,400 --> 00:24:17,720
So yes, there are 22.

236
00:24:17,930 --> 00:24:20,420
And what is the frame size?

237
00:24:20,870 --> 00:24:21,080
Okay.

238
00:24:21,080 --> 00:24:23,750
664 and that's correct okay.

239
00:24:23,750 --> 00:24:25,640
So that's all from this tutorial.

240
00:24:25,640 --> 00:24:29,720
In this tutorial we have learned how we can create a complete web app using flask.

241
00:24:29,720 --> 00:24:32,000
And you can see that we have test.

242
00:24:32,090 --> 00:24:35,150
We have done object detection on images videos.

243
00:24:35,150 --> 00:24:38,180
And we have also tested on the live webcam feed as well.

244
00:24:38,180 --> 00:24:39,680
So that's all from this tutorial.

245
00:24:39,680 --> 00:24:40,760
Thank you for watching.
