1
00:00:02,000 --> 00:00:03,000
I love everyone.

2
00:00:03,000 --> 00:00:07,000
In this video tutorial I will run on Windows.

3
00:00:07,000 --> 00:00:12,000
So first we need to set up environment for YOLO V8 and install required libraries.

4
00:00:12,000 --> 00:00:19,000
I'm using Anaconda Navigator, so I have open Anaconda prompt and so I will create a new environment

5
00:00:19,000 --> 00:00:21,000
with Python version 3.9.

6
00:00:22,000 --> 00:00:29,000
So before I create the new environment, let me show you the folder where I have the input image for

7
00:00:29,000 --> 00:00:32,000
a demo video to test the YOLO V8 model.

8
00:00:37,000 --> 00:00:42,000
So this is the input image and the demo video, of course, which we'll use to test the efficiency of

9
00:00:42,000 --> 00:00:43,000
YOLO V8 model.

10
00:00:52,000 --> 00:00:56,000
So first of all, I will redirect to the folder where I have this.

11
00:00:57,000 --> 00:00:59,000
Input in which video.

12
00:01:00,000 --> 00:01:03,000
Now I will create a new environment and create.

13
00:01:05,000 --> 00:01:06,000
Minus ten.

14
00:01:07,000 --> 00:01:12,000
Know, the A Lecture series will be the name of my environment.

15
00:01:12,000 --> 00:01:18,000
You can choose as per your choice, so you can choose any name for your environment and by conversion

16
00:01:18,000 --> 00:01:19,000
as 3.9.

17
00:01:20,000 --> 00:01:22,000
Now I will click on Enter.

18
00:01:22,000 --> 00:01:24,000
So it will create a new environment.

19
00:01:28,000 --> 00:01:29,000
Just why.

20
00:01:34,000 --> 00:01:36,000
It might take a few minutes, so please bear with me.

21
00:01:41,000 --> 00:01:45,000
No, I will activate the user environment which I have created.

22
00:01:47,000 --> 00:01:49,000
Gonna activate.

23
00:01:50,000 --> 00:01:54,000
Yolo v eight lecture series is the name of my environment.

24
00:01:55,000 --> 00:01:56,000
So I'm activating it.

25
00:02:00,000 --> 00:02:00,000
Okay.

26
00:02:00,000 --> 00:02:02,000
So I have activated my environment.

27
00:02:05,000 --> 00:02:10,000
After activating the environment, I will install ultralytics.

28
00:02:10,000 --> 00:02:12,000
So for this I will write PIP install.

29
00:02:13,000 --> 00:02:14,000
I'll draw.

30
00:02:15,000 --> 00:02:19,000
Radius is equal to 8.0.

31
00:02:21,000 --> 00:02:23,000
Find zero and click on Enter.

32
00:02:25,000 --> 00:02:28,000
So YOLO V8 can be implemented in two ways.

33
00:02:28,000 --> 00:02:31,000
One way is to clone the GitHub repo or.

34
00:02:31,000 --> 00:02:33,000
Other way is to install ultralytics.

35
00:02:33,000 --> 00:02:36,000
So prior versions of YOLO don't have their.

36
00:02:36,000 --> 00:02:37,000
Official package.

37
00:02:37,000 --> 00:02:42,000
So YOLO V8 is the first version of YOLO which has its own package which.

38
00:02:42,000 --> 00:02:42,000
So.

39
00:02:42,000 --> 00:02:46,000
YOLO V8 can be implemented by just writing PIP install ultralytics.

40
00:02:46,000 --> 00:02:48,000
So it's very easy and simple.

41
00:02:49,000 --> 00:02:53,000
So write python over here and see if I have installed torch.

42
00:02:54,000 --> 00:02:55,000
Fort Dodge.

43
00:02:58,000 --> 00:03:00,000
Uh, is this module available or not?

44
00:03:00,000 --> 00:03:01,000
Let's see.

45
00:03:01,000 --> 00:03:06,000
Okay, so this module is available, but in case if this module is not available.

46
00:03:06,000 --> 00:03:08,000
So how to install it?

47
00:03:08,000 --> 00:03:10,000
Let me show you over here as well.

48
00:03:16,000 --> 00:03:20,000
So you just need to go to the PyTorch website and click on Get Started.

49
00:03:22,000 --> 00:03:26,000
And here you will select by Dodge, build stable or operating system as Windows.

50
00:03:26,000 --> 00:03:28,000
But if it is Mac, you can select Mac.

51
00:03:28,000 --> 00:03:32,000
If it is Linux, you can select Linux, then package it with PIP.

52
00:03:33,000 --> 00:03:39,000
Language will be Python and I don't have label, so if I have to install this package I will select

53
00:03:39,000 --> 00:03:40,000
CPU.

54
00:03:40,000 --> 00:03:47,000
But if you have label you just need to go click here copy and you just need to go to.

55
00:03:50,000 --> 00:03:53,000
Anaconda prompt and just exit over here.

56
00:03:56,000 --> 00:03:57,000
And just did this.

57
00:03:57,000 --> 00:04:05,000
But as I don't have Gouda so it will definitely give error because I don't have a GPU available.

58
00:04:05,000 --> 00:04:06,000
Okay.

59
00:04:07,000 --> 00:04:12,000
So next I will go and run YOLO V8.

60
00:04:12,000 --> 00:04:14,000
For object detection.

61
00:04:14,000 --> 00:04:17,000
So let's run YOLO V8 for the object detection.

62
00:04:21,000 --> 00:04:23,000
So to run your revered for objection.

63
00:04:23,000 --> 00:04:23,000
Right.

64
00:04:23,000 --> 00:04:26,000
Your low dose is equal to detect.

65
00:04:32,000 --> 00:04:33,000
What is equal to predict.

66
00:04:36,000 --> 00:04:39,000
Modern is equal to YOLO.

67
00:04:40,000 --> 00:04:42,000
We ate and bought.

68
00:04:44,000 --> 00:04:47,000
Source is equal to image.

69
00:04:47,000 --> 00:04:52,000
The name of our input image which have saved in the folder is.

70
00:04:53,000 --> 00:04:54,000
Image dot jpg.

71
00:04:54,000 --> 00:04:56,000
And just run it.

72
00:05:00,000 --> 00:05:02,000
And see what the results do we get.

73
00:05:03,000 --> 00:05:05,000
It might take a few seconds or a minute.

74
00:05:06,000 --> 00:05:09,000
So let's wait and see what the results to.

75
00:05:11,000 --> 00:05:14,000
So it's downloading the Pre-trained model over here.

76
00:05:15,000 --> 00:05:17,000
The Pre-trained model is downloaded.

77
00:05:18,000 --> 00:05:19,000
Okay.

78
00:05:19,000 --> 00:05:21,000
So image.jpg is not defined.

79
00:05:21,000 --> 00:05:22,000
Sorry.

80
00:05:22,000 --> 00:05:26,000
The name of my input image was image one dot jpg.

81
00:05:27,000 --> 00:05:29,000
So just correcting it.

82
00:05:47,000 --> 00:05:52,000
So you can see that our results are saved in run detection.

83
00:05:52,000 --> 00:05:59,000
Predict two and our model was able to detect 10%, one bus, two traffic light, two backpacks and two

84
00:05:59,000 --> 00:06:01,000
handbag in the image.

85
00:06:01,000 --> 00:06:07,000
So let's see the results and then we will run object detection on our video as well.

86
00:06:12,000 --> 00:06:17,000
So here is the input image which I have passed, and this is my model which was downloaded.

87
00:06:17,000 --> 00:06:25,000
When we run the script and here runs folder in which my output of output image is saved.

88
00:06:25,000 --> 00:06:27,000
So let's check the output image.

89
00:06:35,000 --> 00:06:37,000
So this is my output image.

90
00:06:37,000 --> 00:06:40,000
You can see that the model was working very fine.

91
00:06:40,000 --> 00:06:45,000
It is able to detect the traffic light persons and back and very well.

92
00:06:45,000 --> 00:06:47,000
So the results are quite fine.

93
00:06:47,000 --> 00:06:54,000
So now let's test this model on a demo video so as I don't have a GPU available, so the processing

94
00:06:54,000 --> 00:06:55,000
will be a bit slow.

95
00:06:55,000 --> 00:07:00,000
So let's wait and see the results on a demo video as well.

96
00:07:00,000 --> 00:07:04,000
So to run on a demo video, I will just change the source as.

97
00:07:06,000 --> 00:07:16,000
denmark.mp four and just demo.mp four is the name of my input video on which I want to perform the detection.

98
00:07:23,000 --> 00:07:25,000
So it might take a few more seconds.

99
00:07:25,000 --> 00:07:26,000
So let's wait and see.

100
00:07:31,000 --> 00:07:40,000
So you can see that as I don't have a GPU available, I'm using CPU so the detections are a bit slow.

101
00:07:40,000 --> 00:07:42,000
So I have already run this script.

102
00:07:42,000 --> 00:07:45,000
So let me show you the output which I got.

103
00:07:54,000 --> 00:08:00,000
But this is the output demo video which was getting you can see that the results were very fine.

104
00:08:01,000 --> 00:08:04,000
You can see that the model was able to detect the car's track.

105
00:08:04,000 --> 00:08:09,000
There is a wrong prediction of track, but overall the results were fine.

106
00:08:09,000 --> 00:08:13,000
Like the model was able to detect the cars, truck and so on.

107
00:08:13,000 --> 00:08:16,000
So now we will move towards the.

108
00:08:17,000 --> 00:08:21,000
Anaconda prompt and let's explore some further things.

109
00:08:25,000 --> 00:08:28,000
You can set the confidence value as per our choice if we want.

110
00:08:28,000 --> 00:08:32,000
Our deduction shouldn't be below a certain confidence.

111
00:08:32,000 --> 00:08:36,000
So we can set the value of confidence as per our requirements.

112
00:08:36,000 --> 00:08:42,000
So here, for example, I am setting the confidence value as 0.8.

113
00:08:42,000 --> 00:08:47,000
So the deductions below the confidence 0.8 will not be appearing.

114
00:08:47,000 --> 00:08:53,000
So let's set the confidence as 0.8 and click on Run and see what results do we get.

115
00:09:03,000 --> 00:09:06,000
So our output is saved in runs.

116
00:09:06,000 --> 00:09:07,000
Detect prediction file.

117
00:09:07,000 --> 00:09:09,000
Let's see what the output do we get?

118
00:09:10,000 --> 00:09:11,000
Okay.

119
00:09:17,000 --> 00:09:19,000
This move course differed?

120
00:09:25,000 --> 00:09:26,000
Is the prediction pipe folder.

121
00:09:26,000 --> 00:09:28,000
And here is our output.

122
00:09:28,000 --> 00:09:32,000
So let's see what is different from the previous one over here.

123
00:09:39,000 --> 00:09:39,000
Thought.

124
00:09:39,000 --> 00:09:40,000
Now you can see that.

125
00:09:42,000 --> 00:09:44,000
Few deductions are missing or not.

126
00:09:44,000 --> 00:09:45,000
We are out.

127
00:09:45,000 --> 00:09:47,000
For example, we are unable to detect the bus.

128
00:09:47,000 --> 00:09:49,000
We are unable to detect the traffic light.

129
00:09:49,000 --> 00:09:52,000
We are unable to detect these two persons as well.

130
00:09:53,000 --> 00:09:53,000
Okay.

131
00:09:53,000 --> 00:09:59,000
The reason why we cannot detect these two persons because we have set the confidence value limit as

132
00:09:59,000 --> 00:10:01,000
0.8.

133
00:10:01,000 --> 00:10:09,000
So the model will not detect those in which order, will not do the reductions or the detections will

134
00:10:09,000 --> 00:10:14,000
not be printed, which have a confidence value less than 0.8.

135
00:10:14,000 --> 00:10:21,000
So only those detection will be printed on the image which have a confidence value above 0.8.

136
00:10:23,000 --> 00:10:26,000
Okay, so let's explore some other things as well.

137
00:10:29,000 --> 00:10:33,000
The other thing is that we want to save the bounding box for great sports.

138
00:10:33,000 --> 00:10:36,000
Want to save the bounding box option so we can write.

139
00:10:38,000 --> 00:10:39,000
Complete.

140
00:10:41,000 --> 00:10:42,000
Saved dash tags.

141
00:10:43,000 --> 00:10:45,000
Is equal to true.

142
00:10:45,000 --> 00:10:48,000
So this will save the bounding box information.

143
00:10:48,000 --> 00:10:50,000
Let me just click over here.

144
00:10:52,000 --> 00:10:54,000
You can see the bounding box coordinates.

145
00:10:54,000 --> 00:10:56,000
Information will be saved in a text file.

146
00:10:56,000 --> 00:10:59,000
If we reset save dash text is equal to true.

147
00:11:01,000 --> 00:11:08,000
So our output is saving prediction six labels world and let's see what do without what output do we

148
00:11:08,000 --> 00:11:08,000
get?

149
00:11:10,000 --> 00:11:11,000
So.

150
00:11:12,000 --> 00:11:17,000
I'm just going to prediction six folder and if you see labels.

151
00:11:17,000 --> 00:11:19,000
So here you will save image file.

152
00:11:19,000 --> 00:11:21,000
So let me show you this image file.

153
00:11:23,000 --> 00:11:28,000
So now in this, you can see that these are our detections coordinates.

154
00:11:28,000 --> 00:11:32,000
For example, 26 represents the class number.

155
00:11:32,000 --> 00:11:40,000
These x, these are to the X1Y1 coordinates the top left, and these two are the bottom right coordinates

156
00:11:40,000 --> 00:11:41,000
of the bounding box.

157
00:11:41,000 --> 00:11:45,000
So for each class, we have the coordinates.

158
00:11:45,000 --> 00:11:46,000
And this is the class number.

159
00:11:46,000 --> 00:11:49,000
This is our top left coordinates.

160
00:11:49,000 --> 00:11:51,000
And these two are the top left coordinates.

161
00:11:51,000 --> 00:11:54,000
And these two are the bottom right coordinates.

162
00:11:54,000 --> 00:11:59,000
So in this way, we have the coordinates for each of the objects in our image detected.

163
00:11:59,000 --> 00:12:00,000
Object in the image.

164
00:12:02,000 --> 00:12:04,000
So now let's see for the new things.

165
00:12:05,000 --> 00:12:08,000
So if we want to crop all the.

166
00:12:09,000 --> 00:12:10,000
The teeth were.

167
00:12:10,000 --> 00:12:14,000
For example, we have detected 5% damage.

168
00:12:14,000 --> 00:12:17,000
So I want to crop on the detected persons in the image.

169
00:12:17,000 --> 00:12:20,000
We can do also do this by restricting.

170
00:12:20,000 --> 00:12:22,000
Save dashboard.

171
00:12:30,000 --> 00:12:31,000
Is equal to true.

172
00:12:33,000 --> 00:12:37,000
So this will save all the detected objects in the image separately.

173
00:12:38,000 --> 00:12:40,000
Etsy would do the results.

174
00:12:40,000 --> 00:12:40,000
Do we get.

175
00:12:40,000 --> 00:12:42,000
Then I will show you the results as well.

176
00:12:43,000 --> 00:12:47,000
So the results are saved in run detect predict seven labels folder.

177
00:12:47,000 --> 00:12:48,000
Let's see the results.

178
00:12:56,000 --> 00:12:57,000
So click on crops.

179
00:12:58,000 --> 00:13:00,000
So let me see what.

180
00:13:01,000 --> 00:13:03,000
So you can see over here.

181
00:13:03,000 --> 00:13:04,000
Let me open this image.

182
00:13:09,000 --> 00:13:15,000
So you can see that only this bus is detected like you can not see our other objects.

183
00:13:15,000 --> 00:13:22,000
So the the frame in which we have the bus, we have only this frame a separately stored.

184
00:13:22,000 --> 00:13:24,000
So let's see other objects as well.

185
00:13:36,000 --> 00:13:38,000
Just open this image and say.

186
00:13:40,000 --> 00:13:41,000
Resemble this.

187
00:13:42,000 --> 00:13:45,000
This bonding box or this is also separately shaped.

188
00:13:45,000 --> 00:13:51,000
So using touch image, we can save each of the bounding box separately or each of the detected image

189
00:13:51,000 --> 00:13:52,000
separately.

190
00:13:53,000 --> 00:13:55,000
Okay, let's explore some new things together.

191
00:14:00,000 --> 00:14:00,000
Okay.

192
00:14:00,000 --> 00:14:01,000
So.

193
00:14:03,000 --> 00:14:11,000
Now you can see that we can also remove labels or hide labels or hide the confidence value as well.

194
00:14:11,000 --> 00:14:13,000
So to do this, I will just write.

195
00:14:16,000 --> 00:14:18,000
Eight dash labels.

196
00:14:19,000 --> 00:14:20,000
Is equal to true.

197
00:14:22,000 --> 00:14:25,000
And a great confidence.

198
00:14:26,000 --> 00:14:26,000
Equal to.

199
00:14:29,000 --> 00:14:29,000
So.

200
00:14:33,000 --> 00:14:37,000
Of this will hide the labels and copy value from the.

201
00:14:37,000 --> 00:14:40,000
Objects in the image or the bounding boxes as well.

202
00:14:40,000 --> 00:14:42,000
It will also hide the.

203
00:14:42,000 --> 00:14:44,000
Objects in the.

204
00:14:44,000 --> 00:14:49,000
It will also hide the labels and the confidence values in the videos as well.

205
00:14:49,000 --> 00:14:54,000
So let me show you in the latex, our output is say predicted.

206
00:15:06,000 --> 00:15:08,000
So if I show you this image.

207
00:15:12,000 --> 00:15:17,000
So now you can see that we don't have any confidence value or the label value over here.

208
00:15:17,000 --> 00:15:18,000
So they are missing.

209
00:15:18,000 --> 00:15:24,000
So by setting high dash label two and high dash confidence to hide the confidence value as well as the

210
00:15:24,000 --> 00:15:25,000
label as well.

211
00:15:25,000 --> 00:15:32,000
So now let's move towards the segmentation part and see what do we can implement over there as well.

212
00:15:32,000 --> 00:15:39,000
So to implement the segmentation, you just need to do one thing or you can run the detection on a live

213
00:15:39,000 --> 00:15:40,000
webcam as well.

214
00:15:40,000 --> 00:15:48,000
You just need to show change source as zero and you can test it on live webcam as well by changing source

215
00:15:48,000 --> 00:15:48,000
to zero.

216
00:15:49,000 --> 00:15:50,000
So now.

217
00:15:52,000 --> 00:15:55,000
Just to implement segmentation.

218
00:15:55,000 --> 00:15:59,000
DOS will need to do one thing only by checking.

219
00:15:59,000 --> 00:16:02,000
Changing dos is equal to segment.

220
00:16:06,000 --> 00:16:06,000
Okay.

221
00:16:06,000 --> 00:16:11,000
And just click and just you need to change the modulor as d'assise.

222
00:16:11,000 --> 00:16:17,000
So Shg represents segmentation while for classification, while right click.

223
00:16:17,000 --> 00:16:18,000
Okay.

224
00:16:18,000 --> 00:16:22,000
While for simple reduction just right YOLO, V8 and V8.

225
00:16:22,000 --> 00:16:23,000
So just click on enter now.

226
00:16:25,000 --> 00:16:26,000
And see what results do we get?

227
00:16:30,000 --> 00:16:32,000
So it might take a few seconds.

228
00:16:32,000 --> 00:16:34,000
So let's wait and see what results we are getting.

229
00:16:42,000 --> 00:16:46,000
Okay, so our results are saving one segment predict folder.

230
00:16:46,000 --> 00:16:51,000
So let's go to this folder and see what results do we get over here.

231
00:16:52,000 --> 00:16:52,000
Okay.

232
00:16:57,000 --> 00:16:59,000
Select e-mails to assist under or over here.

233
00:17:06,000 --> 00:17:06,000
Strong.

234
00:17:06,000 --> 00:17:07,000
Let's open this.

235
00:17:07,000 --> 00:17:09,000
So this is our output image.

236
00:17:09,000 --> 00:17:10,000
Let's see this image.

237
00:17:10,000 --> 00:17:12,000
What results we are getting over here.

238
00:17:23,000 --> 00:17:30,000
So you can see that we are able to implement detection as well as segmentation as well.

239
00:17:30,000 --> 00:17:33,000
So the bus is being segmented as green.

240
00:17:33,000 --> 00:17:40,000
So here we are implementing semantic segmentation while the persons are have a mask of maroon, while

241
00:17:40,000 --> 00:17:44,000
hand backpack, backpack has the mask of yellow.

242
00:17:44,000 --> 00:17:49,000
So this is basically semantic segmentation, like same object, have the same mask, while different

243
00:17:49,000 --> 00:17:53,000
objects have the different masks and upon different color of the bounding box.

244
00:17:54,000 --> 00:17:57,000
So let's implement some further things over here.

245
00:17:57,000 --> 00:18:01,000
So in the segmentation as well, we can hide label as well as the confidence value.

246
00:18:01,000 --> 00:18:03,000
Let me show you how you can do this.

247
00:18:09,000 --> 00:18:10,000
Well here.

248
00:18:10,000 --> 00:18:10,000
And you just write.

249
00:18:10,000 --> 00:18:12,000
Hi, neighbors.

250
00:18:14,000 --> 00:18:15,000
Is equal to true.

251
00:18:16,000 --> 00:18:21,000
And confidence is equal to true.

252
00:18:23,000 --> 00:18:24,000
Please click on this.

253
00:18:31,000 --> 00:18:33,000
So it might take a few seconds to run.

254
00:18:36,000 --> 00:18:36,000
Okay.

255
00:18:36,000 --> 00:18:40,000
So I think that I have not written the spelling of convenience.

256
00:18:40,000 --> 00:18:41,000
There is a mistake there.

257
00:18:41,000 --> 00:18:42,000
Let.

258
00:18:43,000 --> 00:18:44,000
Can you see?

259
00:18:47,000 --> 00:18:47,000
Okay.

260
00:18:47,000 --> 00:18:49,000
So I have written.

261
00:18:50,000 --> 00:18:51,000
Okay.

262
00:18:55,000 --> 00:18:56,000
So there is a space issue.

263
00:18:57,000 --> 00:18:58,000
Let me correct it.

264
00:18:58,000 --> 00:19:04,000
So please, while implementing this, make sure that there is no such space and click on Enter.

265
00:19:04,000 --> 00:19:04,000
Now.

266
00:19:06,000 --> 00:19:08,000
And see what the results do we get here?

267
00:19:11,000 --> 00:19:12,000
Might take a few seconds.

268
00:19:12,000 --> 00:19:16,000
Okay, so the results are saved in run segment prediction.

269
00:19:16,000 --> 00:19:19,000
So let's move towards there and see what results do we get.

270
00:19:31,000 --> 00:19:36,000
So now you can see that our output image does not contain a label and the confidence value.

271
00:19:36,000 --> 00:19:41,000
So this is the output that neither we have, the label or the confidence value.

272
00:19:43,000 --> 00:19:49,000
Well, not if we want to show the output in real time what we need to, but just add one thing.

273
00:19:49,000 --> 00:19:52,000
Just add show is equal to true.

274
00:19:52,000 --> 00:19:58,000
It will display your output in real time, but it will be appear only for one millisecond.

275
00:19:58,000 --> 00:19:58,000
Let's see.

276
00:19:59,000 --> 00:20:02,000
So just press enter and see.

277
00:20:02,000 --> 00:20:09,000
It might take few seconds to execute, so wait for few seconds until it executes.

278
00:20:09,000 --> 00:20:10,000
Okay.

279
00:20:10,000 --> 00:20:14,000
So it will appear only for one millisecond as you can see.

280
00:20:14,000 --> 00:20:16,000
And our output is saved in runs.

281
00:20:16,000 --> 00:20:20,000
Predict four and let me show you the output.

282
00:20:21,000 --> 00:20:24,000
Okay, so it's just seven runs, predict four.

283
00:20:24,000 --> 00:20:27,000
So here is our output.

284
00:20:27,000 --> 00:20:28,000
You can see over here.

285
00:20:32,000 --> 00:20:33,000
Just opening it now.

286
00:20:36,000 --> 00:20:38,000
So this is our output.

287
00:20:38,000 --> 00:20:40,000
You can see that.

288
00:20:40,000 --> 00:20:46,000
But by writing show is equal to two, we are able to display the output in real time for one millisecond

289
00:20:46,000 --> 00:20:49,000
and output is saved in the folder as well.

290
00:20:49,000 --> 00:20:51,000
So let's move forward now.

291
00:20:56,000 --> 00:21:03,000
Well now to convert our V8 model into Onnx format, I will write YOLO mod is equal to export loss is

292
00:21:03,000 --> 00:21:04,000
equal to DEC.

293
00:21:04,000 --> 00:21:09,000
If we have a detection model in the case of segmentation, we will write segment and in the case of

294
00:21:09,000 --> 00:21:12,000
classification we will write CLS and model YOLO V8.

295
00:21:12,000 --> 00:21:16,000
Empty and format is equal to on x.

296
00:21:16,000 --> 00:21:19,000
So after adding this, click on enter and let's wait.

297
00:21:24,000 --> 00:21:26,000
It might take a few seconds for the execution.

298
00:21:26,000 --> 00:21:31,000
So let's wait and see how our model is converted into Onnx format.

299
00:21:35,000 --> 00:21:42,000
We are able to convert our YOLO V8 model into Onnx format so it is saved as Yolo v8 n dot onec.

300
00:21:42,000 --> 00:21:45,000
So let me show you this file as well.

301
00:21:48,000 --> 00:21:51,000
So here we have the dot Onex file you can see over here.

302
00:21:51,000 --> 00:21:56,000
So we have successfully converted our model into onex format.

303
00:21:57,000 --> 00:21:59,000
N dot onex file here.

304
00:22:03,000 --> 00:22:07,000
Now what to do all this in Python instead of one line?

305
00:22:07,000 --> 00:22:09,000
I will go to go to my folder.

306
00:22:11,000 --> 00:22:15,000
Okay, so in this folder I will have created a file by the name prediction.

307
00:22:15,000 --> 00:22:17,000
I have created a.py file.

308
00:22:17,000 --> 00:22:20,000
prediction.py file which you can see over here.

309
00:22:20,000 --> 00:22:22,000
Now I will create a project in PyCharm.

310
00:22:22,000 --> 00:22:23,000
Let me open PyCharm.

311
00:22:25,000 --> 00:22:27,000
So this I have opened PyCharm.

312
00:22:27,000 --> 00:22:31,000
I have created a project and here I have the prediction.py file.

313
00:22:31,000 --> 00:22:38,000
So here I have written the code here, so let me explain you the port from ultralytics import yolo.

314
00:22:38,000 --> 00:22:41,000
Then I have initialized YOLO with the model name.

315
00:22:41,000 --> 00:22:44,000
You can see here I have passed the name my model.

316
00:22:44,000 --> 00:22:50,000
Yolo V8 and you can pass any pre-trained model or if you have any custom model, you can also add it.

317
00:22:50,000 --> 00:22:52,000
Add that model over here.

318
00:22:52,000 --> 00:22:55,000
Then I have I am using model dot predict.

319
00:22:55,000 --> 00:22:58,000
So predict method takes all the parameters of the command line interface.

320
00:22:58,000 --> 00:23:05,000
So here I have defined my input image image one dot jpg save is equal to true and to save the bounding

321
00:23:05,000 --> 00:23:07,000
box coordinates information.

322
00:23:07,000 --> 00:23:13,000
I have written a save dash text is equal to true as well and I have set the confidence value is equal

323
00:23:13,000 --> 00:23:15,000
to 0.5.

324
00:23:15,000 --> 00:23:18,000
Now let's run this script using Anaconda prompt.

325
00:23:19,000 --> 00:23:22,000
So I have open anaconda prompt and here I will write.

326
00:23:24,000 --> 00:23:29,000
Light on prediction, dot pie and press enter.

327
00:23:30,000 --> 00:23:34,000
So now the script will execute and take a few seconds.

328
00:23:34,000 --> 00:23:37,000
So let's wait and see our results Look.

329
00:23:39,000 --> 00:23:43,000
And so it might take a few more seconds, so please bear with me.

330
00:23:43,000 --> 00:23:45,000
It will not take more than two seconds.

331
00:23:45,000 --> 00:23:51,000
So now our results are saving runs detect, predict well and labels.

332
00:23:51,000 --> 00:23:52,000
So let's go towards this folder.

333
00:23:56,000 --> 00:24:03,000
Okay runs detect predict 12 and here you can see the output image.

334
00:24:03,000 --> 00:24:05,000
Let me show you this image as well.

335
00:24:06,000 --> 00:24:08,000
So just opening the image.

336
00:24:08,000 --> 00:24:13,000
And so this is our output image, which you can see over here.

337
00:24:13,000 --> 00:24:15,000
The detections look very fine.

338
00:24:15,000 --> 00:24:17,000
So last we can also see.

339
00:24:19,000 --> 00:24:25,000
Our Indian labels folder by bounding box card in this text file by bounding box coordinates are saved,

340
00:24:25,000 --> 00:24:27,000
so you can check it as well.

341
00:24:27,000 --> 00:24:33,000
Now we will see how we can convert our YOLO model into an ONNX format.

342
00:24:33,000 --> 00:24:35,000
So let me show you this as well.

343
00:24:39,000 --> 00:24:41,000
Convert model in x format.

344
00:24:41,000 --> 00:24:44,000
Just point out this line and write model dot export.

345
00:24:45,000 --> 00:24:48,000
Format is equal to.

346
00:24:50,000 --> 00:24:53,000
Interest and overdubbed an X.

347
00:24:53,000 --> 00:24:58,000
Now just save it and just open Anaconda prompt.

348
00:25:01,000 --> 00:25:06,000
And right by Thorne reduction dot pi.

349
00:25:06,000 --> 00:25:13,000
And just press enter and see whether our model is converted into onnx format or not.

350
00:25:17,000 --> 00:25:22,000
But we can see that our model is successfully converted into Onnx format.

351
00:25:22,000 --> 00:25:25,000
Let me show you the Onnx file as well.

352
00:25:25,000 --> 00:25:31,000
So if we go over here, this is the YOLO V8 and dot on X file.

353
00:25:31,000 --> 00:25:36,000
So we have converted our model YOLO with our model into onnx format.

354
00:25:39,000 --> 00:25:41,000
This video tutorial we have implemented.

355
00:25:41,000 --> 00:25:44,000
Object Segmentation and detection using VR.

356
00:25:44,000 --> 00:25:48,000
In the next video tutorial, we will run it in Google CoLab.

357
00:25:49,000 --> 00:25:51,000
See you all in the next video tutorial.

358
00:25:51,000 --> 00:25:52,000
Till then, bye bye.

