1
00:00:02,330 --> 00:00:08,750
This video tutorial we will learn how we can do automatic number plate recognition using YOLO v ten

2
00:00:08,750 --> 00:00:10,580
and paddle OCR.

3
00:00:10,610 --> 00:00:17,420
We will also explore how we can save the license plate detection data to a SQL database.

4
00:00:17,420 --> 00:00:19,340
So let's get started with it.

5
00:00:19,340 --> 00:00:24,110
So I've divided this complete tutorial into these five steps which I have mentioned over here.

6
00:00:24,110 --> 00:00:31,380
So first of all we will see how we can detect license plates using YOLO YOLO is basically the latest

7
00:00:31,380 --> 00:00:36,900
state of the art object detection model, and we will be using this YOLO model in this project.

8
00:00:36,900 --> 00:00:41,040
So in the step number one we will detect license plates using yolo v ten.

9
00:00:41,040 --> 00:00:46,020
And in the step number two we will recognize text on the license plate.

10
00:00:46,020 --> 00:00:50,880
Like we will read the text on the license plate like one, two, three or whatever it is.

11
00:00:50,880 --> 00:00:55,060
So we will read the text on the license plate using paddle OCR.

12
00:00:55,840 --> 00:01:00,730
Then in the step number three we will accumulate the unique license plates.

13
00:01:00,730 --> 00:01:06,910
Like we will accumulate the unique license plate means like we will only we will create a list.

14
00:01:06,910 --> 00:01:13,210
We will, uh, add only the unique license plates like there would be no duplications over there.

15
00:01:13,420 --> 00:01:19,970
So then after accumulating the unique license plate, then we'll save the accumulated unique license

16
00:01:19,970 --> 00:01:24,290
plate to a JSON file after every 20s.

17
00:01:25,610 --> 00:01:29,150
So first of all, we will accumulate the unique license plate.

18
00:01:29,150 --> 00:01:35,210
Then we'll save the accumulated unique license plate to a JSON file after every 20s.

19
00:01:35,210 --> 00:01:38,990
So before uh, in the step number two, we will do two things.

20
00:01:38,990 --> 00:01:47,310
So we will after every 20s interval, we will generate a JSON file, uh, in our JSON directory, which

21
00:01:47,310 --> 00:01:48,960
will contain the start time.

22
00:01:48,960 --> 00:01:53,610
The end time, like the 20 interval start time and 22nd interval end time.

23
00:01:53,610 --> 00:01:59,970
And we will have the the directory license plates data which the license plates which are detected during

24
00:01:59,970 --> 00:02:01,320
that 20s interval.

25
00:02:01,320 --> 00:02:08,440
So after every 22nd inverter well we will generate a JSON file which will have the three things.

26
00:02:08,440 --> 00:02:15,430
One is the start time and one is the end time, and the next will be the license plates which will are

27
00:02:15,430 --> 00:02:17,650
detected during this 20s interval.

28
00:02:17,650 --> 00:02:19,510
So there can be five lessons played.

29
00:02:19,510 --> 00:02:24,730
There can be ten lessons played, or there can be only one license plate that is detected during the

30
00:02:24,730 --> 00:02:29,540
22nd interval, or might be the license plate is directly during that 20s interval.

31
00:02:29,540 --> 00:02:31,490
So this is the one thing which we will do.

32
00:02:31,490 --> 00:02:37,550
And the second thing will be that we will create a cumulative JSON file like, um, one thing I told

33
00:02:37,550 --> 00:02:42,170
you in the first step, like, uh, previously like we will be generating a new JSON file after every

34
00:02:42,170 --> 00:02:43,340
20s interval.

35
00:02:43,520 --> 00:02:51,050
Plus we will also generate a one single cumulative JSON file which will contain all the detected license

36
00:02:51,050 --> 00:02:53,220
plate data for that the 20s.

37
00:02:53,520 --> 00:02:54,390
Like this is the.

38
00:02:54,600 --> 00:02:57,930
These are the license plate detected in the first 22nd interval.

39
00:02:57,930 --> 00:03:00,930
These are the license plate detected during the next 22nd interval.

40
00:03:00,960 --> 00:03:04,050
These are the license plate detected during the third 22nd interval.

41
00:03:04,260 --> 00:03:10,740
So in the cumulative JSON file one JSON file will have all the license plate detected uh, during all

42
00:03:10,740 --> 00:03:12,210
the 20s interval.

43
00:03:12,240 --> 00:03:12,840
Okay.

44
00:03:14,640 --> 00:03:19,420
Then in the step number five, what we'll do, we will save the license plate detection data to a SQL

45
00:03:19,420 --> 00:03:20,200
database.

46
00:03:20,200 --> 00:03:26,290
So we will be using SQLite which is a lightweight disk based database and which is easy to set up and

47
00:03:26,290 --> 00:03:26,860
use.

48
00:03:26,860 --> 00:03:33,040
So uh, before we go ahead, let me show you how our simulated JSON file will look like.

49
00:03:33,040 --> 00:03:34,750
So you have no doubts about it.

50
00:03:38,380 --> 00:03:46,130
So now over here you can see that these are all the JSON files that are generated after every 22nd interval.

51
00:03:46,130 --> 00:03:47,480
Like you can see over here.

52
00:03:47,480 --> 00:03:52,100
All these are the JSON files that are generated after every 22nd interval.

53
00:03:52,100 --> 00:03:58,370
And here you can see at the top this is our cumulative JSON file which is given over here by the name

54
00:03:58,370 --> 00:03:59,270
license plates.

55
00:03:59,270 --> 00:04:02,690
So let me open it over here and let me navigate.

56
00:04:03,920 --> 00:04:07,590
So now you can see over here this is the cumulative JSON file.

57
00:04:07,590 --> 00:04:11,070
So now you can see that 2413 2433.

58
00:04:11,070 --> 00:04:12,720
So these are the 22nd table.

59
00:04:12,720 --> 00:04:18,270
And these is the list of the license plate that are detected during that 22nd interval.

60
00:04:18,390 --> 00:04:21,630
So now as the first 22nd interval and over here.

61
00:04:21,630 --> 00:04:24,900
So the next 22nd interval will be starting from here as well.

62
00:04:24,900 --> 00:04:26,010
Like you can see.

63
00:04:26,010 --> 00:04:28,290
And it will end at 2454.

64
00:04:28,290 --> 00:04:33,280
And these are the lists of the license plates that are detected during that 22nd interval.

65
00:04:33,280 --> 00:04:39,040
Now the here we can see that the last 22nd interval ends and the next 22nd interval will start from

66
00:04:39,040 --> 00:04:40,900
here and it will end from here.

67
00:04:40,900 --> 00:04:45,250
And these are the license plate that are detected during that 22nd interval.

68
00:04:45,520 --> 00:04:50,620
So now here you can see this is the cumulative JSON file which contains all the list of the license

69
00:04:50,620 --> 00:04:53,690
plates that are detected during that 20s interval.

70
00:04:54,140 --> 00:04:54,800
Okay.

71
00:04:56,510 --> 00:05:03,020
And over here you can see that output like these are the JSON file that are generated after every 22nd

72
00:05:03,020 --> 00:05:03,410
interval.

73
00:05:03,410 --> 00:05:06,170
So let me show you one of these as well.

74
00:05:09,740 --> 00:05:13,400
So now over here you can see that this is our start time.

75
00:05:13,400 --> 00:05:14,330
This is the end time.

76
00:05:14,330 --> 00:05:18,810
And you can see this is a list of split data directory during that 22nd interval.

77
00:05:18,810 --> 00:05:24,960
So this is our uh this one file look like that is generated after every 20s.

78
00:05:24,960 --> 00:05:25,710
Terrible.

79
00:05:26,100 --> 00:05:26,640
Okay.

80
00:05:26,670 --> 00:05:29,070
Uh, let me open another one over here.

81
00:05:32,250 --> 00:05:38,040
So now you can see over here, uh, this is another JSON file that is being generated after every 22nd

82
00:05:38,040 --> 00:05:38,430
interval.

83
00:05:38,430 --> 00:05:40,740
And we can see the start time and end time.

84
00:05:40,740 --> 00:05:42,870
So this is how it looks like.

85
00:05:43,230 --> 00:05:48,180
Uh, so this is an overview of how we are going to implement this project.

86
00:05:51,600 --> 00:05:56,250
In the step number one, uh, we will see how we can fine tune the Yolov2 model on the license plate

87
00:05:56,250 --> 00:05:57,000
data set.

88
00:05:57,000 --> 00:06:02,220
In the previous video tutorial hike, I have already explained you how you can fine tune the Yolov2

89
00:06:02,310 --> 00:06:04,290
model on any custom data set.

90
00:06:04,770 --> 00:06:08,980
So now I will not go any details over here, I will just give you a general overview.

91
00:06:09,010 --> 00:06:13,480
How you how you can fine tune the YOLO model on the license plate data set.

92
00:06:13,480 --> 00:06:16,750
So over here this is the data set which I will be using.

93
00:06:16,750 --> 00:06:22,600
So if you haven't created account on Roboflow you can simply create an account on Roboflow and download

94
00:06:22,600 --> 00:06:24,280
this data set over here.

95
00:06:25,180 --> 00:06:30,800
And if you just click on this data set over here uh download zip to computer and you can currently use

96
00:06:30,800 --> 00:06:36,200
the Yolo V8 format because we can format is currently not available over here.

97
00:06:36,440 --> 00:06:39,470
Uh, so basically Yolo Britain is built upon the Yolo V8.

98
00:06:39,470 --> 00:06:42,470
So you can use the Yolo V8 format over here.

99
00:06:42,470 --> 00:06:46,220
And you can simply write show download code over here.

100
00:06:46,220 --> 00:06:52,820
And if you just copy this code and add into your Google Colab notebook, you will be able to export

101
00:06:52,820 --> 00:06:56,520
this data set from Roboflow into your Google Colab notebook.

102
00:06:56,640 --> 00:06:59,100
Okay, and this is our how our data set looks like.

103
00:06:59,100 --> 00:07:04,710
We have around 300 images in our data set, and we have only one class which is license plate.

104
00:07:04,830 --> 00:07:05,250
Okay.

105
00:07:05,250 --> 00:07:11,760
And if I just go to the health check over here, like we have 300 images and we have a total of 333

106
00:07:11,760 --> 00:07:13,470
annotations in these 300 images.

107
00:07:13,470 --> 00:07:16,590
And we have only one class, uh, which is license.

108
00:07:16,590 --> 00:07:17,770
And everything looks fine.

109
00:07:17,770 --> 00:07:20,230
Like for one class, 300 images are good enough.

110
00:07:20,230 --> 00:07:23,230
And you can see, uh, this is how our data set look like.

111
00:07:23,230 --> 00:07:28,540
Like you can see we have a bounding box around, uh, license plate, and we have the name written over

112
00:07:28,540 --> 00:07:28,840
here.

113
00:07:28,840 --> 00:07:29,770
License.

114
00:07:29,800 --> 00:07:30,190
Okay.

115
00:07:30,190 --> 00:07:36,610
So we will be using this data set, and we will be fine tuning the model on this license plate data

116
00:07:36,610 --> 00:07:37,180
set.

117
00:07:38,020 --> 00:07:43,340
So first of all, um, I will not run this script again because we need to write down the complete code,

118
00:07:43,460 --> 00:07:44,270
uh, in the next part.

119
00:07:44,270 --> 00:07:46,130
So this is quite a lengthy task.

120
00:07:46,370 --> 00:07:46,760
Okay.

121
00:07:46,760 --> 00:07:49,790
So first of all, you will clone the YOLO and GitHub repo over here.

122
00:07:49,790 --> 00:07:53,150
Then we will you will install all the required packages okay.

123
00:07:53,150 --> 00:07:53,840
Over here.

124
00:07:53,840 --> 00:07:58,010
And then um you will download the pre-trained model weights over here.

125
00:07:58,010 --> 00:08:04,490
And then I've showed you how you can download a data set from Roboflow into your Google Code Colab notebook

126
00:08:04,490 --> 00:08:05,220
over here.

127
00:08:06,420 --> 00:08:12,000
Then we'll fine tune the Yolov2 model on this lesson's Great data set, which will download it from

128
00:08:12,000 --> 00:08:14,640
Roboflow into this Google Colab notebook.

129
00:08:14,640 --> 00:08:20,370
And you can see over here, uh, we have fine tuned the model for 120 epochs.

130
00:08:20,370 --> 00:08:24,900
And let's see what our final mean average precision scores we get okay.

131
00:08:24,900 --> 00:08:31,720
So we have got a mean average precision score with IOU 0.5 as 0.867 and mean average precision score

132
00:08:31,720 --> 00:08:40,060
when IOU varies from 0.5 to 0.95 is 0.486, and we have got a good precision score of 0.90, like 90%,

133
00:08:40,060 --> 00:08:42,430
and the recall score is 79.4%.

134
00:08:42,430 --> 00:08:44,230
So these are good okay.

135
00:08:44,230 --> 00:08:47,080
And this is the like precision confidence curve.

136
00:08:47,080 --> 00:08:51,910
Like uh what we precision score we have got at different confidence thresholds like you can see.

137
00:08:51,910 --> 00:08:53,990
And here we have the recall confidence curve.

138
00:08:54,140 --> 00:08:57,260
Like what recall score we have got at different threshold.

139
00:08:57,260 --> 00:08:59,780
And here we have the precision recall curve.

140
00:08:59,780 --> 00:09:02,630
And uh here we have the F1 confidence curve.

141
00:09:02,810 --> 00:09:07,250
Like what F1 score we have got at different uh confidence threshold like F1 score.

142
00:09:07,280 --> 00:09:09,920
Tell us the trade off between the precision and recall.

143
00:09:10,160 --> 00:09:13,280
Um so basically now we have the confusion matrix.

144
00:09:13,280 --> 00:09:17,290
Confusion matrix tells us basically how our model handles different classes.

145
00:09:17,290 --> 00:09:21,490
So um, here the testing is being performed on the validation data data set.

146
00:09:21,490 --> 00:09:27,430
And now you can see that, uh, around at 56 instances, our model is able to detect correctly that

147
00:09:27,430 --> 00:09:32,830
there is a license plate while and 12 instances when there was a license plate, our model is unable

148
00:09:32,830 --> 00:09:37,720
to detect that, uh, there is a license plate, and with, uh, it is unable to detect anything.

149
00:09:37,720 --> 00:09:38,320
Okay.

150
00:09:40,030 --> 00:09:43,120
So here we have the confusion matrix over here.

151
00:09:43,120 --> 00:09:48,670
Like you can see 82% of the times our model predicted that there is a license plate and 18% of the time

152
00:09:48,670 --> 00:09:50,110
like then there is a license plate.

153
00:09:50,110 --> 00:09:52,030
Our model is unable to detect anything.

154
00:09:52,030 --> 00:09:56,530
And like you can see over here, our mean average precision score is continuously improving.

155
00:09:56,530 --> 00:10:01,690
And uh, as we increase the number of epochs during training and these are the model predictions on

156
00:10:01,690 --> 00:10:02,710
the training batches.

157
00:10:02,710 --> 00:10:05,720
So we can ignore it because we are using the same data for training.

158
00:10:05,720 --> 00:10:08,240
And these are the model prediction on the validation batch.

159
00:10:08,450 --> 00:10:11,870
Uh, we can view it because these images are not used for the training.

160
00:10:11,870 --> 00:10:15,350
So it's always better to take a look and see how our model is performing.

161
00:10:15,350 --> 00:10:19,820
Like you can see there, there we have a number plate, but our model is unable to detect it.

162
00:10:19,820 --> 00:10:23,570
While in all other cases the model is able to detect the license plate.

163
00:10:23,720 --> 00:10:26,750
So after training the model have saved the model weights on the drive.

164
00:10:26,750 --> 00:10:30,450
So I'm directly downloading the model weights from the drive into this Google Colab notebook.

165
00:10:30,450 --> 00:10:33,030
And then I'm doing some inference on these images.

166
00:10:33,030 --> 00:10:36,120
Like you can see over here, we are able to track the license plate.

167
00:10:36,120 --> 00:10:43,350
Then next what I'm doing is that I'm testing my model on a demo video to see if I am able to detect

168
00:10:43,350 --> 00:10:44,760
the license plate or not.

169
00:10:44,760 --> 00:10:48,570
So let me download this video and show you how our output looks like.

170
00:10:53,860 --> 00:10:56,380
So let me just navigate my screen towards it.

171
00:10:59,410 --> 00:11:05,770
So now you can see over here, uh, we are able to detect a license plate like you can see over here.

172
00:11:05,770 --> 00:11:08,050
And the detection results are quite impressive.

173
00:11:08,050 --> 00:11:12,370
Like we are accurately able to detect the license plate by a very good margin.

174
00:11:13,150 --> 00:11:16,510
Okay, so the detection results look quite impressive.

175
00:11:16,570 --> 00:11:21,080
Uh, so now I have shown you how you can fine tune the YOLO model to detect the license plate.

176
00:11:21,080 --> 00:11:23,030
So the step number one is done.

177
00:11:26,120 --> 00:11:30,890
Now, as you can see over here, I have created a new project in my PyCharm community Edition.

178
00:11:30,890 --> 00:11:35,210
So in the step number one we will clone the Yolo v ten GitHub repo over here.

179
00:11:35,210 --> 00:11:40,370
So uh, as you can see over here, this is the official YOLO and GitHub repo.

180
00:11:40,370 --> 00:11:44,280
So I will just pop over here and copy this stuff from here.

181
00:11:45,720 --> 00:11:50,280
And just I will just write it down and I will just add this thing over here.

182
00:11:50,280 --> 00:11:53,970
So now you can see the repository is being cloned over here.

183
00:11:53,970 --> 00:11:57,150
So it will take few more seconds before it gets completed.

184
00:11:57,300 --> 00:11:57,660
Okay.

185
00:11:57,660 --> 00:12:00,390
So now in the next step we will install all the required packages.

186
00:12:00,390 --> 00:12:05,250
So I will just write install hyphen a dot.

187
00:12:05,980 --> 00:12:08,230
So now all the packages will get installed.

188
00:12:08,230 --> 00:12:10,270
So this will take few more seconds.

189
00:12:10,840 --> 00:12:11,560
Okay.

190
00:12:12,280 --> 00:12:12,520
Okay.

191
00:12:12,520 --> 00:12:12,760
No.

192
00:12:12,760 --> 00:12:13,990
Also, I have made a mistake.

193
00:12:13,990 --> 00:12:14,920
I have not set.

194
00:12:15,280 --> 00:12:19,960
Uh, so if I just go over here.

195
00:12:23,770 --> 00:12:24,310
Yeah.

196
00:12:24,520 --> 00:12:27,280
Uh, the repository is being cloned.

197
00:12:33,140 --> 00:12:35,210
Here you can see we have the cloned repository.

198
00:12:35,210 --> 00:12:38,750
I need to set this repository as my current directory.

199
00:12:38,750 --> 00:12:39,290
And.

200
00:12:39,290 --> 00:12:40,040
That's right.

201
00:12:41,180 --> 00:12:41,840
So let's see.

202
00:12:41,840 --> 00:12:43,370
Hopefully this will work.

203
00:12:44,720 --> 00:12:49,250
So now you can see it's installing build dependencies over here.

204
00:12:49,550 --> 00:12:52,820
Uh so this will take some time uh, to get completed.

205
00:12:58,500 --> 00:13:01,530
But in the meanwhile, I will just create a script over here.

206
00:13:09,630 --> 00:13:15,930
And pr.py and pz dot stands for automatic number plate recognition.

207
00:13:16,590 --> 00:13:17,250
Okay.

208
00:13:18,130 --> 00:13:21,670
So this now all the packages are being getting installed.

209
00:13:21,670 --> 00:13:24,640
So this will take some time like you can see over here.

210
00:13:26,260 --> 00:13:28,090
So this is a bit time consuming.

211
00:13:43,970 --> 00:13:46,220
So we will also okay.

212
00:13:46,220 --> 00:13:48,350
So this package is also installed.

213
00:13:48,350 --> 00:13:50,480
So we don't need to install it separately.

214
00:13:50,780 --> 00:13:55,610
Okay I think um all the packages are being getting installed over here.

215
00:13:58,730 --> 00:14:04,130
So now I will just create another folder into this project with the name resources, where I will add

216
00:14:04,130 --> 00:14:10,590
some images and videos so that I can test, uh, do the testing later on, uh, of our model, like

217
00:14:10,590 --> 00:14:14,280
whether it is able to detect the license plate or read the license plate or not.

218
00:14:16,770 --> 00:14:21,930
Here you can see that I have just created a folder inside this project over here, uh, by the name

219
00:14:21,930 --> 00:14:22,530
resources.

220
00:14:22,530 --> 00:14:24,240
Here you can see we have some car images.

221
00:14:24,240 --> 00:14:27,960
And here we have some videos of cars over here.

222
00:14:27,960 --> 00:14:33,670
So we will be detecting and recognizing the license plate in this video as well as in these images as

223
00:14:33,670 --> 00:14:34,090
well.

224
00:14:34,090 --> 00:14:37,540
So let's go back to the project over here okay.

225
00:14:37,540 --> 00:14:44,050
So now if I just refresh this over here, we can see the uh resources folder over here.

226
00:14:44,260 --> 00:14:44,440
Yeah.

227
00:14:45,940 --> 00:14:46,750
So.

228
00:14:50,770 --> 00:14:52,000
So let's get started.

229
00:14:52,000 --> 00:15:00,320
So first of all, I will just write import cv2 and from.

230
00:15:00,590 --> 00:15:03,830
So let's uh only read the video at the start.

231
00:15:05,450 --> 00:15:08,660
So first we will create a video capture object over here.

232
00:15:13,400 --> 00:15:14,000
Capture.

233
00:15:14,810 --> 00:15:19,050
And we will go inside the resources folder.

234
00:15:22,410 --> 00:15:32,250
And from there we will just write our lessons one dot mp4.

235
00:15:35,880 --> 00:15:36,480
Okay.

236
00:15:43,690 --> 00:15:46,000
We can add comments over here as well.

237
00:15:46,000 --> 00:15:49,720
Uh, first we will create a, uh, import all the required libraries.

238
00:15:53,650 --> 00:15:56,770
All the required libraries.

239
00:15:58,330 --> 00:16:02,830
And here we are creating our video capture object.

240
00:16:09,640 --> 00:16:10,420
Can you not?

241
00:16:19,420 --> 00:16:21,460
Read this.

242
00:16:22,120 --> 00:16:23,110
If read.

243
00:16:25,900 --> 00:16:30,710
CV2 dot I am show radio.

244
00:16:32,750 --> 00:16:38,420
Name and if CV two dot wait key one.

245
00:16:53,850 --> 00:16:55,140
So then it will break.

246
00:17:14,790 --> 00:17:20,500
And here we can simply write cap dot release.

247
00:17:22,780 --> 00:17:26,380
And we can also write cv2 dot destroy all windows.

248
00:17:34,120 --> 00:17:37,150
In this file.

249
00:17:45,110 --> 00:17:47,300
Okay, so let's run this up now.

250
00:17:48,110 --> 00:17:50,630
I think the indexing will take some time to collate.

251
00:17:50,630 --> 00:17:52,460
Then we will be able to run this up.

252
00:17:52,970 --> 00:17:56,690
So let's wait for the indexing to get complete and then we'll run the script.

253
00:18:00,500 --> 00:18:02,300
Now you can see the indexing is being done.

254
00:18:02,300 --> 00:18:04,670
So let's run this script and let's see.

255
00:18:05,060 --> 00:18:08,070
Now you can see that, uh, the video is running very fine.

256
00:18:08,070 --> 00:18:14,130
So if I just want to run another video, let's right over here and run r.com.

257
00:18:15,000 --> 00:18:20,280
Now you can see the video is running very smoothly and a good frame rate as well.

258
00:18:20,460 --> 00:18:23,280
And you can see that, uh the frame rate is quite good.

259
00:18:23,280 --> 00:18:23,850
Yeah.

260
00:18:24,960 --> 00:18:25,500
Okay.

261
00:18:25,650 --> 00:18:30,610
So everything works currently looking very smooth and fine.

262
00:18:30,850 --> 00:18:37,960
Um, one thing, uh, we can do, but, uh, next, like, uh, let's add the frame rate over here,

263
00:18:38,320 --> 00:18:40,660
or let's keep it away from now.

264
00:18:40,720 --> 00:18:45,070
Uh, we can, uh, do it further on for now.

265
00:18:45,070 --> 00:18:50,020
First, uh, now we will see how we can do, uh, detect the license plate and read the text from the

266
00:18:50,020 --> 00:18:51,010
latent license plate.

267
00:18:51,010 --> 00:18:54,020
So, um, I will just write from ultralytics.

268
00:18:54,620 --> 00:18:57,740
Uh, import yolo v ten.

269
00:18:58,310 --> 00:18:58,730
Okay.

270
00:18:58,730 --> 00:19:00,050
That's good.

271
00:19:03,500 --> 00:19:06,470
Then I will just go over here and just write.

272
00:19:08,630 --> 00:19:20,460
I will just initialize the yolo v and model The site model is equal to yolo v ten.

273
00:19:21,660 --> 00:19:29,640
And then I will just go inside this uh weights directory where I have added the model best weights over

274
00:19:29,640 --> 00:19:30,150
here.

275
00:19:30,540 --> 00:19:33,210
So I will just go inside the weights factory and the site.

276
00:19:33,210 --> 00:19:34,230
best.bt.

277
00:19:35,040 --> 00:19:35,700
Okay.

278
00:19:38,370 --> 00:19:40,080
So that looks good.

279
00:19:45,430 --> 00:19:49,570
Plus, we can initialize the frame count over here as well.

280
00:19:49,600 --> 00:19:54,880
Initialize the frame count and we'll say count is equal to zero.

281
00:19:54,880 --> 00:20:00,160
And here we can write count plus one.

282
00:20:00,610 --> 00:20:04,390
Uh print frame count.

283
00:20:09,380 --> 00:20:09,740
City.

284
00:20:09,740 --> 00:20:10,070
Right.

285
00:20:11,690 --> 00:20:11,960
Name.

286
00:20:11,960 --> 00:20:12,770
Number.

287
00:20:15,380 --> 00:20:17,300
Okay, so let's look promising.

288
00:20:20,150 --> 00:20:25,550
And let's write a result model dot date.

289
00:20:25,550 --> 00:20:25,560
day.

290
00:20:29,910 --> 00:20:33,900
And we can set the conference table to 0.45 over here.

291
00:20:37,710 --> 00:20:41,400
And we can write for result in results.

292
00:20:41,400 --> 00:20:44,490
So we'll loop through uh, each of the bounding boxes.

293
00:20:44,490 --> 00:20:48,510
And uh, then we will draw bounding boxes on each of the license plates.

294
00:20:48,510 --> 00:20:57,670
So first we'll look through each of the bounding boxes and simply write boxes equal to result dot boxes.

295
00:20:59,560 --> 00:20:59,980
Right.

296
00:20:59,980 --> 00:21:03,010
For box boxes.

297
00:21:05,260 --> 00:21:08,710
We have x1 y1 x2 y2.

298
00:21:09,400 --> 00:21:09,790
Okay.

299
00:21:09,790 --> 00:21:13,150
And we can write box dot x y x y.

300
00:21:13,150 --> 00:21:13,160
Why?

301
00:21:17,000 --> 00:21:20,660
So the output which you get from here is in the form of tensors.

302
00:21:20,840 --> 00:21:23,270
Well, let me show you as well.

303
00:21:34,370 --> 00:21:37,940
So let's see if it works fine or if there is an error then we'll fix this up.

304
00:21:44,190 --> 00:21:47,820
Okay, so this will take some time before it gets started to run.

305
00:21:48,300 --> 00:21:48,690
Okay.

306
00:21:48,690 --> 00:21:49,620
We have an error.

307
00:21:49,620 --> 00:21:51,120
So let's see what's that error.

308
00:21:56,520 --> 00:22:00,480
Also we are just facing an error here.

309
00:22:01,290 --> 00:22:01,650
Okay.

310
00:22:01,650 --> 00:22:05,980
So the issue we are just getting is uh this is not installed.

311
00:22:06,490 --> 00:22:06,880
Okay.

312
00:22:06,880 --> 00:22:09,970
So we can simply write, uh.

313
00:22:13,900 --> 00:22:16,030
And let's check out this error.

314
00:22:16,360 --> 00:22:21,520
We don't know what exact package I installed.

315
00:22:21,790 --> 00:22:23,140
Uh, what is this?

316
00:22:24,220 --> 00:22:24,490
Okay.

317
00:22:24,490 --> 00:22:29,080
So we can simply copy this from here and just like.

318
00:22:29,450 --> 00:22:31,880
so, let's see if this works or not.

319
00:22:41,510 --> 00:22:41,720
Okay.

320
00:22:41,720 --> 00:22:43,220
So let's run this again.

321
00:22:48,770 --> 00:22:49,070
Okay.

322
00:22:49,070 --> 00:22:50,900
So it's currently updating indexes.

323
00:22:50,900 --> 00:22:52,220
So this will take some time.

324
00:22:52,220 --> 00:22:55,290
So let's wait for it to get complete.

325
00:22:59,940 --> 00:23:00,870
I think that's done.

326
00:23:18,190 --> 00:23:19,630
And what is there?

327
00:23:23,590 --> 00:23:26,140
NumPy is not available.

328
00:23:35,920 --> 00:23:36,160
Well.

329
00:23:41,870 --> 00:23:44,870
I just found out the solution of the problem that we are facing.

330
00:23:45,050 --> 00:23:50,000
First we need to uninstall numpy and then we need to install numpy with this version.

331
00:23:50,000 --> 00:23:52,190
So this will hopefully solve our problem.

332
00:23:52,190 --> 00:23:53,900
So let's do this.

333
00:23:55,610 --> 00:23:58,340
The meanwhile it gets uninstalled.

334
00:23:58,340 --> 00:24:00,110
Let's run this up now.

335
00:24:05,150 --> 00:24:09,870
Okay so now we are installing this version and hopefully this will work.

336
00:24:10,620 --> 00:24:11,490
Okay.

337
00:24:21,780 --> 00:24:23,310
Currently we are over here.

338
00:24:30,400 --> 00:24:36,490
So now it's just completing the indexing and it will take few more seconds before it gets completed.

339
00:24:47,530 --> 00:24:48,490
Um, next.

340
00:24:48,490 --> 00:24:50,080
Okay, so it's been done.

341
00:24:50,080 --> 00:24:51,430
So let's run this up.

342
00:24:57,380 --> 00:24:59,090
Let's see how does it works.

343
00:25:04,070 --> 00:25:04,370
Okay.

344
00:25:04,370 --> 00:25:06,140
So we have the frame number one over here.

345
00:25:06,140 --> 00:25:07,280
But currently okay.

346
00:25:07,280 --> 00:25:08,750
So here we have the video.

347
00:25:08,780 --> 00:25:10,310
Now currently no detection will be done.

348
00:25:10,310 --> 00:25:13,910
But you can see over here we have the bounding box coordinates over here.

349
00:25:14,120 --> 00:25:15,830
Uh currently it's in the form of tensors.

350
00:25:15,830 --> 00:25:18,000
We need to convert it into integers.

351
00:25:18,030 --> 00:25:20,490
Okay, so if I just press the one key this will stop.

352
00:25:20,490 --> 00:25:21,930
So let's write the rest of the code.

353
00:25:22,530 --> 00:25:24,330
Uh, we can simply move this up.

354
00:25:49,000 --> 00:25:50,620
Then we have the frame.

355
00:25:50,740 --> 00:25:54,730
Let's draw the bounding boxes around the license plates.

356
00:26:00,010 --> 00:26:02,410
The color of the bounding box will be below.

357
00:26:05,140 --> 00:26:06,320
And thickness will be two.

358
00:26:07,580 --> 00:26:08,330
Okay.

359
00:26:08,330 --> 00:26:11,510
And what different classes we have over here.

360
00:26:16,550 --> 00:26:22,460
So we have only one class uh, which is uh, license.

361
00:26:24,440 --> 00:26:24,890
Okay.

362
00:26:29,580 --> 00:26:34,950
So the YOLO written model will give us the class name in the format integers.

363
00:26:36,060 --> 00:26:36,900
So we have.

364
00:26:36,930 --> 00:26:43,110
We can get it by writing box dots plus zero okay.

365
00:26:56,610 --> 00:27:02,340
And now we'll also calculate the confidence score for this math.

366
00:27:18,700 --> 00:27:19,120
Okay.

367
00:27:22,600 --> 00:27:24,490
Then we have the label as.

368
00:27:30,550 --> 00:27:31,390
Last name.

369
00:27:32,500 --> 00:27:33,490
Confidence.

370
00:27:43,250 --> 00:27:45,080
Uh, let's get the text size.

371
00:27:45,080 --> 00:27:48,080
So we'll just write cv2 dot get text size.

372
00:27:52,760 --> 00:27:55,010
One scale will be 0.5.

373
00:27:56,810 --> 00:27:58,430
Thickness of the text will be two.

374
00:28:02,120 --> 00:28:07,230
So we will display the uh uh label which contain the class name and confidence for above the bounding

375
00:28:07,230 --> 00:28:07,800
box.

376
00:28:08,070 --> 00:28:11,220
So for this we can simply write text size zero.

377
00:28:26,100 --> 00:28:28,320
Then I will start with tango.

378
00:28:28,350 --> 00:28:29,740
Over here we have the frame.

379
00:28:34,540 --> 00:28:35,050
Due to.

380
00:28:37,960 --> 00:28:43,420
The color of the bounding box below, which will be added above the bounding detected license plate.

381
00:28:43,420 --> 00:28:46,450
And it will be filled with the blue color.

382
00:28:49,000 --> 00:28:52,000
And we will just put text inside this.

383
00:29:03,950 --> 00:29:06,770
The color of the text will be white.

384
00:29:21,180 --> 00:29:23,850
Okay, so everything looks perfect for now.

385
00:29:27,060 --> 00:29:28,320
Let's run this up now.

386
00:29:44,560 --> 00:29:47,350
So now you can see over here we are able to detect the license plate.

387
00:29:47,350 --> 00:29:49,300
And you can see we have drawn a bounding box.

388
00:29:49,630 --> 00:29:51,670
Uh here we have the class name license.

389
00:29:51,670 --> 00:29:54,220
And here you can see we have the confidence score over here.

390
00:29:54,640 --> 00:29:56,320
Um, the results looks very promising.

391
00:29:56,320 --> 00:29:57,940
Like, the results are good now.

392
00:29:58,840 --> 00:30:01,180
Okay, so let's go ahead.

393
00:30:01,720 --> 00:30:03,610
Let's read the text from license plate.

394
00:30:04,690 --> 00:30:07,190
So we will just write.

395
00:30:07,400 --> 00:30:10,130
We need to install the OCR package.

396
00:30:13,130 --> 00:30:15,500
So let's see how we can do it.

397
00:30:16,220 --> 00:30:22,010
So we need to just install paddle OCR on here so we can just write.

398
00:30:25,040 --> 00:30:26,180
Install paddle OCR.

399
00:30:43,560 --> 00:30:45,240
Uh, meanwhile, the package gets installed.

400
00:30:45,240 --> 00:30:47,520
We can start writing down the code as well.

401
00:30:50,160 --> 00:30:52,410
From OCR import.

402
00:30:55,600 --> 00:30:56,440
Final OCR.

403
00:31:05,110 --> 00:31:05,440
Only.

404
00:31:05,470 --> 00:31:08,650
Here we will initialize the OCR.

405
00:31:12,610 --> 00:31:13,180
OCR.

406
00:31:13,180 --> 00:31:13,250
are.

407
00:31:23,090 --> 00:31:26,990
I don't have a GPU in my local system, so I will just set it to false.

408
00:31:32,720 --> 00:31:35,660
So now we'll also create a function over here for this.

409
00:31:42,090 --> 00:31:44,130
In the frame and the bounding box.

410
00:31:44,130 --> 00:31:44,880
Coordinates.

411
00:32:08,860 --> 00:32:09,220
Okay.

412
00:32:11,320 --> 00:32:14,080
Uh, we don't want to use the pedals here for reduction.

413
00:32:14,080 --> 00:32:16,540
We only want to do recognition using pedal OCR.

414
00:32:30,830 --> 00:32:33,380
And we only want to read that text from the sense plate.

415
00:32:38,420 --> 00:32:41,480
So if nothing is text is read, then this will be empty.

416
00:32:43,100 --> 00:32:49,880
But then we will loop through all the lessons played and we will just read the lesson.

417
00:32:49,880 --> 00:32:51,680
Split text from lessons played.

418
00:32:51,680 --> 00:32:51,690
plate.

419
00:33:00,360 --> 00:33:03,420
Well, I have already done the necessary calculation like this.

420
00:33:03,420 --> 00:33:05,040
Index contain the conference code.

421
00:33:05,040 --> 00:33:09,930
So whenever we read the text from the license plate, we get the confidence code, like how much our

422
00:33:09,930 --> 00:33:17,190
OCR pedal OCR model is confident that, uh, this, uh, that uh, text that the model model model has

423
00:33:17,190 --> 00:33:18,580
read, uh, please.

424
00:33:18,580 --> 00:33:22,570
Like, this is 60% confident that this is the correct text that it has read.

425
00:33:23,320 --> 00:33:25,480
So here we have the following text.

426
00:33:25,480 --> 00:33:26,200
We have the score.

427
00:33:26,200 --> 00:33:32,320
If you want to check more details you can simply write print OCR and just print out the text that it

428
00:33:32,320 --> 00:33:32,710
has read.

429
00:33:32,710 --> 00:33:34,030
So you can have a better idea.

430
00:33:34,030 --> 00:33:37,870
But I'm not doing it correctly because this is already taking so much time.

431
00:33:47,450 --> 00:33:52,370
So if the score is not available, then you set the score is equal to zero.

432
00:33:53,690 --> 00:33:55,820
Else if the score is available.

433
00:33:58,700 --> 00:34:04,370
Then we'll simply multiply the score by 100, because the score will be in the form of 0.60.1 or so.

434
00:34:07,350 --> 00:34:17,790
And if force is greater than 60%, like if the model is 60% confident or more, then we will just write

435
00:34:17,790 --> 00:34:19,560
x or zero.

436
00:34:32,350 --> 00:34:34,330
So after we have written the text.

437
00:34:34,330 --> 00:34:39,970
So now we need to import free so that we can remove any irregularities in the text.

438
00:35:22,890 --> 00:35:26,310
So if there are triple question marks or like such like this stuff.

439
00:35:26,310 --> 00:35:29,580
So we will replace this in our text as well.

440
00:35:29,700 --> 00:35:36,240
And if the text we have the O we will replace the O with zero.

441
00:35:48,280 --> 00:35:50,260
Similarly if we have this as well.

442
00:35:53,800 --> 00:35:55,780
So we have created a function over here.

443
00:35:55,780 --> 00:35:58,210
So let's write down over here as well.

444
00:36:02,380 --> 00:36:04,570
So we can comment this out correctly.

445
00:36:04,570 --> 00:36:06,710
And we can simply write label.

446
00:36:08,900 --> 00:36:11,660
Is equal to pad.

447
00:36:13,940 --> 00:36:14,570
OCR.

448
00:36:14,570 --> 00:36:17,240
And here we have name.

449
00:36:22,490 --> 00:36:23,060
That's good.

450
00:36:26,720 --> 00:36:29,480
So let's run this up and see how does it works.

451
00:36:50,370 --> 00:36:50,640
For.

452
00:36:56,770 --> 00:36:57,400
Yeah, okay.

453
00:37:00,370 --> 00:37:02,860
So I've installed already installed Docker.

454
00:37:02,860 --> 00:37:03,130
But.

455
00:38:03,710 --> 00:38:04,310
So it's done.

456
00:38:04,310 --> 00:38:05,720
So let's run this up now.

457
00:38:09,360 --> 00:38:09,570
Okay.

458
00:38:09,570 --> 00:38:11,790
So the indexing will take some time to complete.

459
00:38:21,960 --> 00:38:24,180
So let's wait for it to get completed.

460
00:38:24,180 --> 00:38:25,710
Then we can go ahead.

461
00:38:39,310 --> 00:38:41,140
No updating Skelton.

462
00:38:41,140 --> 00:38:42,790
So this will not take very much time.

463
00:38:54,800 --> 00:38:56,990
And installed packages switched on.

464
00:38:59,330 --> 00:39:00,680
So let's run this up now.

465
00:39:26,100 --> 00:39:29,250
Okay, I'm already open.

466
00:39:29,370 --> 00:39:29,640
Okay.

467
00:39:29,640 --> 00:39:32,100
So let's resolve this error as well.

468
00:39:32,100 --> 00:39:34,740
So we'll just write port OS.

469
00:39:46,660 --> 00:39:47,320
AMP.

470
00:39:47,320 --> 00:39:48,040
Dash.

471
00:39:49,390 --> 00:39:50,380
Duplicate.

472
00:40:02,500 --> 00:40:04,270
I hope this will solve this error.

473
00:40:07,370 --> 00:40:11,180
So that we can solve any, uh, duplicate library issues.

474
00:40:23,870 --> 00:40:25,490
Let's see how does it works.

475
00:40:31,230 --> 00:40:37,320
So now you can see over here we are able to read the text from the license plate like our 183JF.

476
00:40:37,950 --> 00:40:41,790
So we are able to read the text from the license plate and it looks good.

477
00:40:42,420 --> 00:40:47,220
So let's see if we are able to read the text from the other license plates as well or not.

478
00:40:47,370 --> 00:40:47,550
Um.

479
00:40:49,560 --> 00:40:50,040
Let's see.

480
00:40:51,330 --> 00:40:51,570
Okay.

481
00:40:52,380 --> 00:40:55,930
For this current license plate, we are able to read the text from the license plate.

482
00:40:55,930 --> 00:41:00,160
So now you can see that we have integrated YOLO v ten and OCR code.

483
00:41:00,160 --> 00:41:05,230
We are using Yolo v ten to detect the license plate and to read the text from the license plate.

484
00:41:05,230 --> 00:41:07,360
We are using paddle OCR.

485
00:41:08,050 --> 00:41:08,350
Okay.

486
00:41:08,350 --> 00:41:13,450
So currently you can see the text is not very clear, like it's N8N9 for j v.

487
00:41:13,450 --> 00:41:16,570
So we are able to read the text on the license plate here as well.

488
00:41:16,570 --> 00:41:18,290
So that looks amazing.

489
00:41:18,290 --> 00:41:23,720
Like we have used pedal ACR to read the text from the license plate and the results are very impressive.

490
00:41:23,930 --> 00:41:29,870
Okay, so now the next step we need to, uh, save the license plate data into a JSON file.

491
00:41:29,870 --> 00:41:31,670
So let's work towards it.

492
00:41:35,060 --> 00:41:40,640
So I will just create a function over here save JSON okay.

493
00:41:40,640 --> 00:41:43,560
In the input will be the unique license plates.

494
00:41:43,920 --> 00:41:44,520
Okay.

495
00:41:47,130 --> 00:41:56,100
And the start time, because we need, uh, to save the license plates, uh, data after every 20s interval.

496
00:42:00,630 --> 00:42:12,970
So we need to generate individual JSON files for each 22nd interval.

497
00:42:13,390 --> 00:42:14,110
Okay.

498
00:42:15,430 --> 00:42:20,020
So in the interval data we have.

499
00:42:25,060 --> 00:42:27,370
We have our time.

500
00:42:31,430 --> 00:42:31,700
Okay.

501
00:42:34,220 --> 00:42:36,260
Start time will be in the ISO format.

502
00:42:38,540 --> 00:42:40,640
Similarly, we also have the end time.

503
00:42:43,400 --> 00:42:46,610
And end time will be also in the ISO format.

504
00:42:49,220 --> 00:42:50,840
Then we have the license plate.

505
00:42:50,840 --> 00:42:53,930
And the license plate will be in the form of lists.

506
00:43:05,070 --> 00:43:09,390
And the interval file path will be as following.

507
00:43:13,200 --> 00:43:18,670
Also we need to create a directory over here by the name Jason.

508
00:43:19,660 --> 00:43:23,440
And inside this will write a data file with the name output.

509
00:43:36,610 --> 00:43:39,670
And here we have um air.

510
00:43:39,670 --> 00:43:39,680
Year.

511
00:43:42,590 --> 00:43:43,400
Month.

512
00:43:43,910 --> 00:43:44,420
Day.

513
00:43:45,290 --> 00:43:46,310
Hours.

514
00:43:46,850 --> 00:43:47,720
Minutes.

515
00:43:47,720 --> 00:43:48,590
Seconds.

516
00:43:50,810 --> 00:43:54,410
And just save it in the form of a JSON.

517
00:43:54,590 --> 00:43:55,970
Okay, so that's no good.

518
00:43:58,010 --> 00:43:59,930
And we'll just right click open.

519
00:44:10,590 --> 00:44:11,700
Interval file path.

520
00:44:22,110 --> 00:44:23,100
Interval data.

521
00:44:23,220 --> 00:44:27,840
And inside this, uh, JSON file, we build up this interval data.

522
00:44:36,250 --> 00:44:38,080
And we have the intern test.

523
00:44:38,110 --> 00:44:39,430
So that's good.

524
00:44:39,880 --> 00:44:44,380
So this will generate individual generation file for each 22nd interval.

525
00:44:45,970 --> 00:44:49,300
Then next we need to generate a cumulative JSON file as well.

526
00:44:49,300 --> 00:44:50,080
So.

527
00:44:59,150 --> 00:45:01,220
we need to define the cumulative.

528
00:45:05,450 --> 00:45:07,070
File path as well.

529
00:45:09,020 --> 00:45:11,390
And this will be inside the JSON directory.

530
00:45:11,390 --> 00:45:13,400
And the file name will be less since.

531
00:45:15,410 --> 00:45:17,960
The data project.

532
00:45:20,700 --> 00:45:21,990
And then we'll just try to.

533
00:45:21,990 --> 00:45:26,670
If there exists a cumulative file path.

534
00:45:31,890 --> 00:45:34,050
Then we'll open the cumulative file.

535
00:45:44,920 --> 00:45:45,490
Read it.

536
00:45:52,840 --> 00:45:55,630
Then we'll load the existing data over here.

537
00:45:58,690 --> 00:46:00,790
That we have inside this file.

538
00:46:03,850 --> 00:46:09,410
And the existing Existing data will be empty.

539
00:46:15,980 --> 00:46:20,810
So now we'll add new interval data to this cumulative file.

540
00:46:37,890 --> 00:46:38,940
Existing data dot.

541
00:46:38,940 --> 00:46:39,840
Append.

542
00:46:42,300 --> 00:46:43,110
One data.

543
00:46:45,810 --> 00:46:47,700
I can simply write will open.

544
00:47:13,030 --> 00:47:14,260
So that looks good.

545
00:47:21,020 --> 00:47:23,630
So now next week, what we'll do is.

546
00:47:34,220 --> 00:47:36,170
So now we can just try it over here.

547
00:47:39,650 --> 00:47:41,030
So we have.

548
00:47:43,820 --> 00:47:44,810
All this stuff.

549
00:47:46,970 --> 00:47:50,720
Where I have initialized, we have.

550
00:47:50,720 --> 00:47:52,490
Start time is equal to.

551
00:47:54,890 --> 00:47:55,220
Date.

552
00:47:55,220 --> 00:47:55,520
Time.

553
00:47:55,520 --> 00:47:55,820
Dot.

554
00:47:55,820 --> 00:47:56,330
Now.

555
00:48:02,600 --> 00:48:04,130
Here we have the current timers.

556
00:48:12,570 --> 00:48:14,040
Okay, so that looks good.

557
00:48:23,040 --> 00:48:24,870
Next what we will do over here is.

558
00:48:31,540 --> 00:48:35,320
Now we'll just separate the 20s time interval.

559
00:48:47,140 --> 00:48:54,770
So if we have the time is greater or equal to 20s, then we have the end time.

560
00:48:56,600 --> 00:48:56,930
Run.

561
00:48:59,930 --> 00:49:00,470
Time.

562
00:49:05,270 --> 00:49:11,150
Okay, so first we need to save the license plate data like we have to accumulate.

563
00:49:11,300 --> 00:49:16,370
Add unique license plates into our JSON file okay.

564
00:49:16,370 --> 00:49:16,380
Okay.

565
00:49:18,390 --> 00:49:20,640
So for this I will just write over here.

566
00:49:28,560 --> 00:49:29,160
Okay.

567
00:49:32,700 --> 00:49:37,380
So if we have read some text then we'll just write if label.

568
00:49:43,600 --> 00:49:47,770
So if we have label, then we will add this unique license plate over here.

569
00:49:49,120 --> 00:49:49,690
Okay.

570
00:49:51,940 --> 00:49:55,630
Then I will just write over here license plates.

571
00:49:57,550 --> 00:50:03,280
Then we have the start time and time over here.

572
00:50:04,090 --> 00:50:04,480
Okay.

573
00:50:07,610 --> 00:50:08,000
Okay.

574
00:50:09,710 --> 00:50:13,310
Then we have the start time as run time.

575
00:50:13,310 --> 00:50:14,090
Over here.

576
00:50:14,960 --> 00:50:15,500
Okay.

577
00:50:15,500 --> 00:50:15,980
Start time.

578
00:50:16,610 --> 00:50:17,660
That's fine.

579
00:50:22,070 --> 00:50:25,130
And then we will just clear all this data.

580
00:50:28,640 --> 00:50:31,860
For the next 22nd, Jake's on file.

581
00:50:32,250 --> 00:50:35,520
So let's run this and see how it works.

582
00:50:56,230 --> 00:50:58,210
So this will take few more seconds.

583
00:51:01,300 --> 00:51:01,630
Okay.

584
00:51:01,630 --> 00:51:03,040
Where has this error?

585
00:51:19,910 --> 00:51:23,150
Okay, so we need to write from date time.

586
00:51:24,290 --> 00:51:24,800
Okay.

587
00:51:25,040 --> 00:51:26,810
I think this will solve the error.

588
00:51:26,810 --> 00:51:27,260
Let's see.

589
00:51:49,920 --> 00:51:53,250
So now you can see that we are able to create the license plate.

590
00:51:53,730 --> 00:51:53,940
Okay.

591
00:51:53,940 --> 00:52:00,690
So let me open this up as well and see if we are able to save the status.

592
00:52:05,850 --> 00:52:07,990
So here we will have a JSON files.

593
00:52:07,990 --> 00:52:10,060
But let's see what does it do.

594
00:52:10,600 --> 00:52:11,800
I think there's an error.

595
00:52:13,270 --> 00:52:13,810
Okay.

596
00:52:13,810 --> 00:52:15,670
So let's fix up this error.

597
00:52:16,000 --> 00:52:16,180
Uh.

598
00:52:32,690 --> 00:52:33,440
Okay.

599
00:52:37,880 --> 00:52:39,350
I think this will fix this up.

600
00:52:39,350 --> 00:52:40,490
And let's run this again.

601
00:53:06,120 --> 00:53:09,510
So now you can see we are able to read the text of license plates over here.

602
00:53:12,210 --> 00:53:15,450
And let's see if we have the JSON file over here or not.

603
00:53:25,240 --> 00:53:26,530
Currently it's empty.

604
00:53:27,280 --> 00:53:28,150
Okay.

605
00:53:37,210 --> 00:53:37,720
Okay.

606
00:53:37,720 --> 00:53:39,940
I just got this error over here.

607
00:53:39,940 --> 00:53:43,550
Let's run this again now and see how does it works.

608
00:53:47,900 --> 00:53:50,780
Now let's run this again and see if it works or not.

609
00:53:50,780 --> 00:53:53,180
So I will just run this script now.

610
00:54:04,250 --> 00:54:08,940
So it should generate a JSON file after every 22nd interval.

611
00:54:08,940 --> 00:54:14,250
So now you can see over here, uh, it will generate individual JSON files for each 22nd interval.

612
00:54:14,250 --> 00:54:20,280
And there will be a cumulative JSON file, uh, which will contain the timestamps for all the intervals

613
00:54:20,280 --> 00:54:24,060
as well as the license plate data for all the intervals as well.

614
00:54:24,060 --> 00:54:29,070
So now it has started and we will see our JSON files in in this folder.

615
00:54:29,070 --> 00:54:30,240
Currently it's empty.

616
00:54:30,340 --> 00:54:34,390
Uh, it will be generating JSON files after every 22nd interval.

617
00:54:34,390 --> 00:54:36,160
So let's see.

618
00:54:37,210 --> 00:54:37,540
Okay.

619
00:54:37,540 --> 00:54:41,140
So now we have our first, uh, JSON file over here.

620
00:54:41,140 --> 00:54:41,380
Okay.

621
00:54:41,380 --> 00:54:43,000
So let's uh see.

622
00:54:43,000 --> 00:54:49,330
So now you can see over here we have uh our interval like 4440 and 45.

623
00:54:49,330 --> 00:54:53,890
And here you can see this is the state that have been detected during this 22nd interval.

624
00:54:53,890 --> 00:54:56,450
And this is the cumulative JSON file over here.

625
00:54:56,450 --> 00:55:02,570
And you can see over here the same interval and the data which has been detected.

626
00:55:02,570 --> 00:55:09,200
So now we can see after a 22nd interval we have another JSON file which is from this interval to this

627
00:55:09,200 --> 00:55:09,680
interval.

628
00:55:09,680 --> 00:55:13,370
And this is the license plate data detected during this interval.

629
00:55:14,420 --> 00:55:15,680
And this is a completed file.

630
00:55:15,680 --> 00:55:20,700
So now you can see this is the uh license plate detected during this first 22nd interval.

631
00:55:20,700 --> 00:55:24,630
And these are the license plates that are detected during the next 22nd interval.

632
00:55:24,900 --> 00:55:25,410
Okay.

633
00:55:26,700 --> 00:55:28,890
So now this is the third JSON file.

634
00:55:28,890 --> 00:55:33,420
So now you can see over here these are the license plate data detected during this interval provided

635
00:55:33,420 --> 00:55:34,170
over here.

636
00:55:34,170 --> 00:55:41,610
And this is accumulated this file which contains um all the data data for all the intervals which have

637
00:55:41,610 --> 00:55:42,580
been currently processed.

638
00:55:44,320 --> 00:55:46,360
So now this is how it works.

639
00:55:46,360 --> 00:55:47,830
So I will not stop this code.

640
00:55:47,830 --> 00:55:53,110
Uh uh uh, currently it will start continue producing the output like you can see over here.

641
00:55:53,110 --> 00:55:57,430
I will not stop the script currently, but uh, we will go towards the next part.

642
00:55:58,390 --> 00:56:03,280
So the next we will see how we can save the license plate data to the SQL database.

643
00:56:03,280 --> 00:56:05,590
So now we will go ahead towards that part.

644
00:56:08,000 --> 00:56:09,980
So we will be using SQLite.

645
00:56:10,220 --> 00:56:12,770
Um so which is a very lightweight.

646
00:56:12,860 --> 00:56:14,330
Lightweight disk based database.

647
00:56:14,330 --> 00:56:17,540
And we will be using the SQL SQLite.

648
00:56:19,070 --> 00:56:21,770
And it is very easy to set up and use as well.

649
00:56:21,770 --> 00:56:25,370
So SQLite SQLite comes pre-installed.

650
00:56:25,370 --> 00:56:26,870
So we not need to install it.

651
00:56:26,870 --> 00:56:30,540
But we need to install uh the SQLite three module.

652
00:56:30,540 --> 00:56:32,550
So let's get started with this.

653
00:56:34,920 --> 00:56:35,640
Just right.

654
00:56:39,600 --> 00:56:43,530
So we'll just copy this from here.

655
00:56:44,460 --> 00:56:48,090
We install this so we can simply go to settings.

656
00:56:49,320 --> 00:56:51,660
Um here we have.

657
00:56:56,530 --> 00:56:59,440
Uh, now here we click on the plus sign.

658
00:57:14,710 --> 00:57:16,510
So here we need to install this package.

659
00:57:16,510 --> 00:57:20,420
So you can simply write, uh, this install this package from here.

660
00:57:20,480 --> 00:57:23,960
Or you can simply write pip install in the terminal as well.

661
00:57:23,960 --> 00:57:25,910
So this is how you can do this.

662
00:57:28,910 --> 00:57:35,300
So here you can simply write import Sqlite3 over here.

663
00:57:42,270 --> 00:57:47,340
So first we need to create an SQLite database and a table to store the license plate data.

664
00:57:47,370 --> 00:57:50,910
So first we need to create a SQLite database and table.

665
00:57:50,910 --> 00:57:52,920
So I will just write SQL.

666
00:57:53,790 --> 00:57:53,970
Uh.

667
00:58:00,000 --> 00:58:01,860
What should I write the name over here.

668
00:58:18,790 --> 00:58:19,630
I will just try.

669
00:58:20,470 --> 00:58:26,440
So first we will create, uh, the SQLite database and a table so that we can store the license plate

670
00:58:26,440 --> 00:58:27,010
data.

671
00:58:27,370 --> 00:58:29,590
So I will resign in protest to like three.

672
00:58:33,880 --> 00:58:36,040
So first we will connect to the.

673
00:58:41,470 --> 00:58:43,630
Light uh database.

674
00:58:47,560 --> 00:58:49,270
Or we will create it.

675
00:59:23,940 --> 00:59:27,690
That will create a cursor object.

676
00:59:30,750 --> 00:59:36,000
Interact with the data base.

677
00:59:45,970 --> 00:59:54,670
So now we will create a table to store the license plate data.

678
59:57.190 --> 1:00:00.970
Let's also execute.

679
1:00:13.670 --> 1:00:17.420
And table if not exists.

680
1:00:28.310 --> 1:00:29.480
So we have.

681
1:01:00.610 --> 1:01:04.120
Then you have the start time and this is in the form of text.

682
1:01:05.290 --> 1:01:07.300
Then you have the end time.

683
1:01:12.340 --> 1:01:17.290
Then we have the license plate like the license plate which are detected.

684
1:01:17.290 --> 1:01:20.060
And this will be in the form of text as well.

685
1:01:25.940 --> 1:01:27.380
So this looks fine.

686
1:01:27.380 --> 1:01:32.810
So now in the meanwhile, like you can see over here, uh, this is ah, all the outputs.

687
1:01:32.810 --> 1:01:36.260
And this is the accumulated JSON file which has been generated.

688
1:01:36.260 --> 1:01:37.400
So this looks good.

689
1:01:39.440 --> 1:01:40.070
Okay.

690
1:01:40.220 --> 1:01:43.020
So now, uh, let's run this.

691
1:01:49.770 --> 1:01:55.800
Now, this will create a SQLite database and a table so that we can where we can store the license plate

692
1:01:55.800 --> 1:01:56.070
data.

693
1:01:56.070 --> 1:01:59.700
So now you can see that, uh, SQLite database have been created.

694
1:01:59.700 --> 1:02:03.750
And so here now we can store our license plate data which you can see over here.

695
1:02:03.750 --> 1:02:08.860
And uh like you can see over here that this file has been created over here.

696
1:02:08.860 --> 1:02:10.510
So, so far, so good.

697
1:02:14.890 --> 1:02:17.890
Now we will save our license plate data to the database.

698
1:02:17.890 --> 1:02:26.530
So now what I will do over here is, uh, you know, write save to.

699
1:02:28.540 --> 1:02:29.590
Database.

700
1:02:32.510 --> 1:02:32.810
Okay.

701
1:02:35.780 --> 1:02:39.110
So the input will be the same which we can find over here.

702
1:02:39.110 --> 1:02:41.270
The exact same input will be passed over here.

703
1:02:43.130 --> 1:02:48.980
So now we'll just write connect Sqlite3 dot connect.

704
1:02:50.900 --> 1:02:53.030
Uh, this is the function created.

705
1:02:55.380 --> 1:02:56.070
Course.

706
1:02:56.070 --> 1:02:56.370
Uh.

707
1:02:58.380 --> 1:03:03.120
One that I saw for plate.

708
1:03:06.120 --> 1:03:06.780
Plates.

709
1:03:11.340 --> 1:03:11.790
Cursor.

710
1:03:11.790 --> 1:03:12.120
Dot.

711
1:03:12.120 --> 1:03:13.080
Execute.

712
1:03:23.710 --> 1:03:24.460
Inside.

713
1:03:38.800 --> 1:03:41.500
Our time and time.

714
1:03:43.130 --> 1:03:43.370
again.

715
1:03:44.180 --> 1:03:44.870
Since.

716
1:03:56.300 --> 1:03:57.620
Then we have values.

717
1:04:25.500 --> 1:04:28.860
I also format like which converted previously as well.

718
1:05:04.910 --> 1:05:09.740
For now, we'll save data to SQL database.

719
1:05:19.740 --> 1:05:26.370
Okay, everything looks fine to me, but, um, let's run this and see how this works.

720
1:05:26.400 --> 1:05:27.180
Start time.

721
1:05:38.550 --> 1:05:41.130
Uh, one thing you need to check.

722
1:06:13.280 --> 1:06:14.960
I think they should match.

723
1:06:18.950 --> 1:06:21.860
Okay, this looks fine.

724
1:06:37.800 --> 1:06:40.320
Yeah, it looks good now.

725
1:06:41.160 --> 1:06:42.540
Just checking it once more.

726
1:06:43.560 --> 1:06:44.640
So let's run this up now.

727
1:07:21.590 --> 1:07:22.580
You can start it.

728
1:07:33.290 --> 1:07:35.540
Okay, so this will take some time.

729
1:07:35.570 --> 1:07:35.870
Okay.

730
1:07:35.870 --> 1:07:36.260
There's a.

731
1:07:41.180 --> 1:07:44.490
Table has no column name and time.

732
1:07:52.770 --> 1:07:53.040
Um.

733
1:07:53.040 --> 1:07:54.570
My mistake.

734
1:08:14.080 --> 1:08:14.830
Understand this.

735
1:08:14.830 --> 1:08:16.540
Hopefully it will work fine now.

736
1:08:37.640 --> 1:08:39.080
There is a mistake as well.

737
1:08:39.080 --> 1:08:40.310
I can see it.

738
1:08:45.020 --> 1:08:45.230
Yeah.

739
1:08:45.230 --> 1:08:49.130
We should have start time and time.

740
1:08:49.160 --> 1:08:49.850
Okay.

741
1:08:53.060 --> 1:08:56.090
I'm now running it again and hopefully this will now work fine.

742
1:09:07.490 --> 1:09:09.260
But let's see how does it goes.

743
1:09:14.000 --> 1:09:14.720
Okay.

744
1:09:15.230 --> 1:09:15.980
Let me remove this.

745
1:09:15.980 --> 1:09:17.120
Previous entries.

746
1:09:25.590 --> 1:09:27.180
On our program has started.

747
1:09:36.570 --> 1:09:37.050
Okay.

748
1:09:37.050 --> 1:09:39.330
And let's see if we have our JSON file.

749
1:09:39.330 --> 1:09:41.880
So now you can see we have our JSON files.

750
1:09:41.880 --> 1:09:42.970
Let's look good.

751
1:09:42.970 --> 1:09:48.670
And if we see now you can see that it's updated as well from the date modified okay.

752
1:09:48.670 --> 1:09:50.980
So now it's hopefully it's working fine.

753
1:09:51.340 --> 1:09:55.990
So let's have some entries and then uh we will uh see our file.

754
1:09:57.040 --> 1:09:58.390
Our database looks like.

755
1:09:59.080 --> 1:10:01.180
So let's continue processing it.

756
1:10:14.150 --> 1:10:16.100
This will take some time still.

757
1:10:16.100 --> 1:10:18.980
I guess it will take much time.

758
1:10:24.980 --> 1:10:29.330
So now you can see as I'm running on CPU machine, the processing is very slow, but if you have a good

759
1:10:29.330 --> 1:10:31.260
GPU the processing will be fast.

760
1:10:31.260 --> 1:10:32.010
Definitely.

761
1:10:43.950 --> 1:10:49.110
So now it's going steady and slow and steady, but it's going smoothly.

762
1:10:50.100 --> 1:10:52.080
So that is what I was expecting.

763
1:10:52.080 --> 1:10:53.430
And it will look good.

764
1:10:53.520 --> 1:10:54.000
Quite good.

765
1:11:01.690 --> 1:11:02.260
Yeah.

766
1:11:03.100 --> 1:11:06.130
So now you can see over here, um, like it's a bit blurred.

767
1:11:06.130 --> 1:11:08.230
So therefore it's painful.

768
1:11:12.730 --> 1:11:16.990
So this is now you can see we have these JSON files till now.

769
1:11:16.990 --> 1:11:22.790
And like you can see over here, our database is being continuously updated like this is our current

770
1:11:22.790 --> 1:11:23.810
database file.

771
1:11:26.360 --> 1:11:28.580
So things look quite smooth and good.

772
1:11:33.500 --> 1:11:34.790
Okay so.

773
1:11:37.010 --> 1:11:40.370
Now to view our SQLite database file.

774
1:11:40.370 --> 1:11:43.440
So I will just write SQLite viewer online.

775
1:11:43.890 --> 1:11:46.620
And over here I will upload this.

776
1:11:46.620 --> 1:11:48.750
So let's wait for it to complete.

777
1:11:48.750 --> 1:11:50.850
And then we will upload our file over here.

778
1:11:55.950 --> 1:11:59.160
By you can see currently we have this I'm just waiting for it to complete.

779
1:11:59.160 --> 1:12:01.470
And then I will show you the file over here.

780
1:12:16.990 --> 1:12:19.330
Currently we have this accumulated data.

781
1:12:19.480 --> 1:12:20.680
That's good as well.

782
1:12:33.350 --> 1:12:34.190
It's a long video.

783
1:12:34.190 --> 1:12:40.670
It's still processing, but we can just pause it over here and currently upload this, our database

784
1:12:40.670 --> 1:12:41.630
file and see.

785
1:12:41.810 --> 1:12:44.840
So I will just go to next to Light Online viewer.

786
1:12:45.110 --> 1:12:49.010
And over here you can see this is my license plate database.

787
1:12:49.010 --> 1:12:50.690
And I will just upload this.

788
1:12:50.690 --> 1:12:54.290
So now you can see these are all the entries we have in our database file.

789
1:12:54.290 --> 1:12:57.510
This is the ID, this is the start time or this is the end time.

790
1:12:57.510 --> 1:13:04.950
And you can see that um like 59 3759, 58 and like this is uh, 22nd time span.

791
1:13:04.950 --> 1:13:11.670
And you can see over here, uh, we have these entries like, like the results were quite good for me

792
1:13:11.670 --> 1:13:11.970
now.

793
1:13:14.100 --> 1:13:18.790
Like, you can see, uh, this is our 22nd again, 22nd time span over here.

794
1:13:18.790 --> 1:13:24.550
And you can see these are the entries which we have found 22nd time span over here as well.

795
1:13:24.550 --> 1:13:28.030
And, uh, that is what looks good to me for now.

796
1:13:28.570 --> 1:13:31.090
Like you can see this is again 22nd time span.

797
1:13:31.090 --> 1:13:33.250
And this is the license plate that has been detected.

798
1:13:33.250 --> 1:13:35.890
And we have just uploaded our database file.

799
1:13:35.890 --> 1:13:39.550
And you can see all the entries over here okay.

800
1:13:39.550 --> 1:13:44.090
3253 like 22nd time span 1333.

801
1:13:44.090 --> 1:13:44.600
Like 26.

802
1:13:44.600 --> 1:13:46.040
Like you can see over here.

803
1:13:46.610 --> 1:13:47.900
So that's good.

804
1:13:47.900 --> 1:13:53.120
So in this tutorial we have learned how we can uh, do uh automatic number plate detection and recognition

805
1:13:53.120 --> 1:13:55.910
using YOLO and uh, OCR.

806
1:13:55.940 --> 1:13:59.390
Plus we have also saved our license plate data into JSON file.

807
1:13:59.390 --> 1:14:04.430
And we have also saved our license plate data into an SQLite database.

808
1:14:04.430 --> 1:14:05.810
So that's all from this tutorial.

809
1:14:05.810 --> 1:14:06.770
Thank you for watching.
