1
00:00:02,000 --> 00:00:08,000
The last video tutorial we have seen that how we can train the YOLO V8 model on personal protective

2
00:00:08,000 --> 00:00:14,000
equipment dataset and after training or fine tuning the YOLO V8 model on personal protective equipment

3
00:00:14,000 --> 00:00:15,000
dataset.

4
00:00:15,000 --> 00:00:23,000
We have tested our trained model on multiple videos and we have seen that the model depicts a very satisfactory

5
00:00:23,000 --> 00:00:29,000
performance and the model was able to detect the protective handmade jackets, eyewear gloves.

6
00:00:29,000 --> 00:00:37,000
So now as we are discussing how we can integrate YOLO model with Flask, so now I will just use the

7
00:00:37,000 --> 00:00:38,000
best words file.

8
00:00:38,000 --> 00:00:38,000
So.

9
00:00:39,000 --> 00:00:45,000
I have just downloaded the password file of my protective personal protective equipment model.

10
00:00:45,000 --> 00:00:51,000
So here you can see that here I have just have the best weights file after training the V8 model on

11
00:00:51,000 --> 00:00:53,000
the personal protective equipment dataset.

12
00:00:53,000 --> 00:00:55,000
So this is my best weights file.

13
00:00:55,000 --> 00:01:00,000
I will just update this best dot file with TPT.

14
00:01:01,000 --> 00:01:07,000
So I've just updated the name of my best weights file as people's personal protective equipment dataset.

15
00:01:08,000 --> 00:01:10,000
I'd go back towards the court.

16
00:01:10,000 --> 00:01:13,000
So all this code is saying that we are discussing already.

17
00:01:13,000 --> 00:01:20,000
So what changes I will make is, first of all, previously when we are previously when we created our

18
00:01:20,000 --> 00:01:25,000
last web app, so we have used the Pre-trained YOLO V8 model.

19
00:01:25,000 --> 00:01:31,000
So the Pre-trained YOLO V8 model has been trained on Coco dataset, which consists of 80 different classes.

20
00:01:31,000 --> 00:01:37,000
But now as we are, we have trained or fine tuned the YOLO V8 model on custom dataset, which is of

21
00:01:37,000 --> 00:01:38,000
personal protective equipment.

22
00:01:38,000 --> 00:01:45,000
So we have seen that our custom in the personal personal protective equipment dataset, we have seven

23
00:01:45,000 --> 00:01:46,000
different classes.

24
00:01:46,000 --> 00:01:50,000
So I have listed all those classes in the sequence wise over here, which you can see.

25
00:01:51,000 --> 00:01:51,000
Okay.

26
00:01:51,000 --> 00:01:57,000
And this is here, I've just passed the dot weights file, which I have over here.

27
00:01:57,000 --> 00:02:01,000
So this is the best weights file which I've renamed as GPT.

28
00:02:01,000 --> 00:02:02,000
Okay.

29
00:02:02,000 --> 00:02:04,000
And it is placing the YOLO weights folder.

30
00:02:04,000 --> 00:02:09,000
And these are the class names or the classes which I have in my dataset.

31
00:02:09,000 --> 00:02:10,000
Okay.

32
00:02:11,000 --> 00:02:15,000
Everything else is same except what I've made further changes that previously.

33
00:02:15,000 --> 00:02:17,000
You can see that with.

34
00:02:17,000 --> 00:02:19,000
For each bounding box we have a pink color.

35
00:02:19,000 --> 00:02:23,000
Okay, so and then the color of the label rectangle was also pink.

36
00:02:23,000 --> 00:02:25,000
But here we have just changed this color, so.

37
00:02:26,000 --> 00:02:32,000
I have just said that if the class name is dust mask, so if you have a dust mask class, then this

38
00:02:32,000 --> 00:02:36,000
color will be assigned to the bounding box as well as to the label rectangle.

39
00:02:36,000 --> 00:02:41,000
And if the class is glove, then this color will be assigned to the bounding box as as as well as the

40
00:02:41,000 --> 00:02:42,000
label rectangle.

41
00:02:42,000 --> 00:02:48,000
And if the class name is protective helmet or if the class is protective helmet, then this color will

42
00:02:48,000 --> 00:02:51,000
be assigned to the bounding box and the label rectangle.

43
00:02:51,000 --> 00:02:58,000
And if if there is any other class, like for example, if we have shield or jacket class, then this

44
00:02:58,000 --> 00:03:01,000
color will assign to that class which I have given over here.

45
00:03:01,000 --> 00:03:08,000
And plus I have set a limit for the confidence board like the bounding box and will only be drawn around

46
00:03:08,000 --> 00:03:11,000
the detected object if we have a confidence score above 0.5.

47
00:03:11,000 --> 00:03:18,000
So if we have a confidence score above 0.5, then only we will have the bounding box and the rectangle

48
00:03:18,000 --> 00:03:21,000
above the bounding box on which we can put the text.

49
00:03:21,000 --> 00:03:22,000
Okay.

50
00:03:23,000 --> 00:03:30,000
So that is the change which made else all the three statement files are same and the flask app.py is

51
00:03:30,000 --> 00:03:30,000
also the same.

52
00:03:30,000 --> 00:03:32,000
There is no made change.

53
00:03:32,000 --> 00:03:35,000
There is no change made in the flask App.py file.

54
00:03:35,000 --> 00:03:40,000
So let's run the flask App.py file and see what results we have got.

55
00:03:40,000 --> 00:03:46,000
We will test the video on the we will test the train YOLO V8 model on personal protective equipment

56
00:03:46,000 --> 00:03:50,000
dataset on videos as well as the live webcam feed.

57
00:03:50,000 --> 00:03:51,000
So let's get started.

58
00:03:52,000 --> 00:03:55,000
So I'm just running the python flask app.py file.

59
00:03:58,000 --> 00:04:01,000
Okay, so this might take some time.

60
00:04:01,000 --> 00:04:02,000
So let's see.

61
00:04:04,000 --> 00:04:06,000
So that might take some time for it to execute.

62
00:04:06,000 --> 00:04:06,000
So.

63
00:04:07,000 --> 00:04:09,000
So now I will just click over this link.

64
00:04:09,000 --> 00:04:12,000
So it will redirect me to the home page.

65
00:04:16,000 --> 00:04:19,000
Okay, so just close one tab.

66
00:04:20,000 --> 00:04:22,000
But we don't need to tell currently.

67
00:04:24,000 --> 00:04:26,000
Well, now we have the home page.

68
00:04:26,000 --> 00:04:29,000
Now let's first test on some videos.

69
00:04:29,000 --> 00:04:31,000
So I will just click on Choose File.

70
00:04:32,000 --> 00:04:38,000
And then I will just go to zero eight crash course.

71
00:04:38,000 --> 00:04:41,000
And in the video section I have some videos.

72
00:04:41,000 --> 00:04:46,000
Let's first test on this demo video and just after uploading the video, click on submit.

73
00:04:46,000 --> 00:04:52,000
So now we will see if our model is able to detect that jacket, protective helmet, gloves, shield

74
00:04:52,000 --> 00:04:53,000
or not.

75
00:04:54,000 --> 00:04:54,000
Okay.

76
00:04:55,000 --> 00:04:55,000
So.

77
00:04:56,000 --> 00:04:57,000
Let see.

78
00:04:57,000 --> 00:04:58,000
What results do we get?

79
00:04:59,000 --> 00:05:00,000
Okay.

80
00:05:01,000 --> 00:05:03,000
Uh, the reductions are about to start.

81
00:05:03,000 --> 00:05:06,000
So now we can see that our model is able to detect a protective helmet.

82
00:05:06,000 --> 00:05:13,000
You can see, as well as our model is able to detect or our web app is able to detect the jacket as

83
00:05:13,000 --> 00:05:13,000
well.

84
00:05:13,000 --> 00:05:18,000
So now you can see over here, we have detected the jacket as well as the jacket.

85
00:05:18,000 --> 00:05:23,000
So although they are wearing gloves, but we are not able to detect it, but we are able to detect the

86
00:05:23,000 --> 00:05:26,000
jacket and as well as the protective helmet.

87
00:05:26,000 --> 00:05:29,000
Now, let's test on another demo video.

88
00:05:30,000 --> 00:05:36,000
Let's upload this video and then click on Submit and see what results do we get.

89
00:05:40,000 --> 00:05:42,000
This might take a few seconds.

90
00:05:43,000 --> 00:05:46,000
So now you can see here this person is not wearing a jacket.

91
00:05:46,000 --> 00:05:52,000
So we have not detected a jacket or this person is wearing a jacket and we have a bounding box around

92
00:05:52,000 --> 00:05:53,000
the jacket.

93
00:05:53,000 --> 00:05:54,000
You can see over here.

94
00:05:54,000 --> 00:05:57,000
Plus, or both of these persons are wearing protective helmet.

95
00:05:57,000 --> 00:06:01,000
And we have detected that both of these persons are wearing a protective helmet.

96
00:06:01,000 --> 00:06:04,000
Thus, although they are not wearing any gloves and shields.

97
00:06:04,000 --> 00:06:07,000
So we have not detected any gloves or shield.

98
00:06:07,000 --> 00:06:12,000
They are only wearing protective helmets and jacket, which we have detected successfully.

99
00:06:12,000 --> 00:06:13,000
So that's impressive.

100
00:06:14,000 --> 00:06:18,000
Now let's test our model on the live webcam feed.

101
00:06:22,000 --> 00:06:29,000
Test the model on live webcam feed will just go back and just click on live webcam from here and let's

102
00:06:29,000 --> 00:06:35,000
test our model on the live webcam feed and see what results do we get from here.

103
00:06:35,000 --> 00:06:39,000
So my camera is just going to turn on.

104
00:06:40,000 --> 00:06:43,000
And let's test our model on the.

105
00:06:44,000 --> 00:06:50,000
Now, you can see over here, our model is able to detect successfully that I'm wearing a dust mask

106
00:06:50,000 --> 00:06:51,000
from here.

107
00:06:52,000 --> 00:06:53,000
Okay.

108
00:06:54,000 --> 00:06:56,000
All the directions.

109
00:06:56,000 --> 00:06:57,000
Fine.

110
00:06:57,000 --> 00:07:04,000
So as I've been wearing a mask, it has detected successfully that I am wearing a dust mask.

111
00:07:04,000 --> 00:07:10,000
Thus, I'm not wearing a jacket or a helmet, so it hasn't attracted anything from here.

112
00:07:10,000 --> 00:07:13,000
I'm just wearing a dust mask, which it has detected successfully.

113
00:07:14,000 --> 00:07:15,000
Okay.

114
00:07:21,000 --> 00:07:28,000
Well, now you can see that we have tested our model on the video as well as on the live webcam feed,

115
00:07:28,000 --> 00:07:30,000
and the results are very satisfying.

116
00:07:30,000 --> 00:07:32,000
So that's all from this course.

117
00:07:32,000 --> 00:07:35,000
I hope you have learned something from this course.

118
00:07:35,000 --> 00:07:37,000
See you all in the next course.

119
00:07:37,000 --> 00:07:38,000
Till then, bye bye.

