In this video tutorial, we will learn how we can fine tune our train geology ten model on a custom
data set.
Geology ten is the latest state of the art real time object detection model that outperforms all the
other YOLO models in terms of speed, accuracy, parameters, efficiency.
So let's get started with it.
So now here you can see this is the Euro weekend GitHub repository.
You can find all the details over here.
Like you can see over here.
The density and accuracy trade off is being presented over here.
And what is basically latency.
Our latency is basically the time taken to do object detection on an input image.
So now you can see here we have written in milliseconds.
And here we have the average precision.
So you can see that uh yolo v ten models outperform all the other models.
Uh in terms of accuracy.
Uh, here you can see the average precision and in terms of, uh, latency as well.
Like you can see that, uh, inference latency of your P10, uh, model is uh, much better as compared
to other YOLO models.
Like, you can see that, uh, YOLO v ten model takes less time to do object detection on input image
like you can see over here.
Uh, like other YOLO models, take very much time to do object detection on an input image, which can
be seen over here.
So the inference latency of V ten model is very good as compared to other YOLO models.
And over here you can see size and accuracy.
Trade off is being presented and where you can see number of parameters.
And this is represented in millions.
Like you can see that uh yellow by ten.
Uh in yellow by ten.
We adopt efficiency driven design strategy which reduces the computational overhead.
And we optimize various model components as well.
So in this case of less number of parameters are used as compared to other YOLO models.
And YOLO v ten also outperforms all the other European models in terms of accuracy as well.
And you can see over here the return comes with uh, six different models here the ten nano, small,
medium, large, extra large.
Over here.
And here you can see if you want to train your model with, uh, ten model on a custom data set.
All the steps are provided over here.
You can check this guide.
Or you can do a predictions on an input image using the pre-trained model weights.
Or fine tune your model weights as well.
Plus here you can find all the details or you can export the model into, uh, Onnx format or in some
other format as well.
And here you can see if you want to do the citations.
All this stuff is being presented over here.
So you can check this GitHub repo and uh, some, uh, all the uh, persons who have contributed into
this wrapper are also mentioned over here.
Uh, what updates they have done, like.
Um, uh, like you can see over here like this, uh, GitHub user has integrated the sword object tracking
as well.
So all these contributions are mentioned over here.
And like, uh, this GitHub user has, uh, added a hugging face demo over here.
Colab demo, all these videos you can find over here as well.
Okay.
And in this video tutorial we'll be fine tuning the YOLO v ten model or training the yellow V ten model
on Personal Protective Equipment data set.
And you can find this data set on Roboflow.
So like you can see all the details over here.
So we will have seven different classes in our data set which includes safety mask just uh, safety
mask vest uh, safety boots over here.
Like you can see over here.
We have the safety boards.
Uh, safety helmet.
Where's our safety mask?
Eyeglasses on these glasses here.
So they are seven different classes in our data set.
And our data set is very much balanced in terms of, uh, which you can find all the details in the
health check over here.
So the dataset throughput and we will be using this data set.
Uh, so to export this data set into Roboflow, you just need to uh, to export this data set from Roboflow
into your Google Colab notebook.
Uh, you need to create an account on Roboflow and, and create an account on Roboflow.
Then you just need to click on download Data set and download so you can there you can download the
data set on your local system, but you can just click on show download code and you can just convert
this dataset into YOLO V8 format and see the written format is not available over here.
So we can use your V8 format.
And.
Here.
Now, if you just, uh, add this word into your Google Colab notebook, you would be able to download
the data set from Roboflow into the Google Colab notebook.
Okay.
So now in the first step, you need to clone the YOLO and GitHub repo.
I have already trained the model on this personal protective data set, because if I start training
over here, this will take so much time.
Uh, but I will explain you all the results that we got.
Now we install all the required packages, uh, that we require to do object detection or, uh, to
fine tune the model.
So these are the all the packages that are required, and these will be installed one by one.
Then over here in the step number three we'll download all the pre-trained model weights.
So let's wait until all these packages get installed.
While you can see all the required packages are installed, it's necessary that you install all the
required packages before you start training the model on custom data set.
So now if I just go over here into the repository and click over here, you can find all the model weights
over here.
We just need to copy the link address.
And you just need to add all these addresses over here.
And this will download the each of the model weights into uh your uh into what this uh folder over here.
So our weights folder will be created over here.
And inside this you can have all the model weights.
We ten model weights added over there.
Okay.
So now uh.
Now this now you can see over here a waste folder is being created and you can find all the model weights
over here.
Okay.
So now we'll download the data set from Roboflow into this Google Colab notebook.
Okay.
So you can simply copy this code over here and just and this code over here.
So this will download the data set from Roboflow into this Colab notebook.
So this will take some time.
Now you can see the data set is being downloaded over here.
So this will take more time over here before it gets to 100%.
Again.
Okay.
Or now you can see we have the data set over here.
Now one thing you before you go ahead, you need to do over here is, uh, you need to rename this folder
and you just need to open a data dot.
YML file over here.
Uh, as you open it, a relatively small file, then you just need to update this path over here.
So you just need to click over here and copy path over here and just add those paths over here.
So these are the two things that are must to do.
Okay, so I just you just need to update these two parts over here, and then you just need to set this
folder as your current directory again.
Okay.
And then we will train the model ten model will be ten model on the custom data set.
So now you can see that we are doing object detection.
The mode is training.
Currently uh we are training a model for 50 epochs.
And the bad side is being set to 16.
Uh, the bad side is being set to, uh, in the powers.
So, uh, if you have a very large data set, then please make sure that you reduce the batch size to
eight.
Okay.
So this is the, uh, batch size.
Basically mean how much chunk we pass the data to the model for the training.
Okay.
Then I'm just using your written nano model.
And here I'm just passing the link to the data dot yml file.
In the YAML file I have the path for training and validation images set.
Okay, so now uh, here I have trained the model for 50 epochs on personal protective equipment data
set.
And you can see that these are the, uh, precision sport.
Uh, we have got over here.
And here we have the record score over here, and here we have the mean average precision, uh, with
I use, uh, 50% or 0.50.
And here we have the mean average precision when IOU varies from 0.5 to 0.95.
Okay.
Uh.
To the Brazilian forest law.
It means that there are many false positives, and if the false positives are low, it means that there
are many false negatives.
But in all the cases, the procedures for export in accepting a shield case, the precision score is
a bit lower.
So it means there are not many false negatives okay.
So now these are the basically uh, this graph basically after training we have these result graphs.
So now you can see that uh, this graph shows uh, how many instances of mass we have in our dusty,
uh, dust mask we have in our training set.
So these are not the images.
These are the number of annotations for the dust masks we have in our training data for the IVR.
And you can see for the shield, we have very low instances of annotations.
Uh, for the shield shield class, we have very low instances for annotations.
So now that is why you can see that, uh, the score is not good and precision score is also low as
compared to other, uh, classes.
Okay.
And here you can see that we have the precision point curve.
So now you can see the precision score over here at different points scores okay.
So this is the precision score over here.
These are the recall score at different confidence schedules over here.
And this is the precision and recall curve.
And here we have the F1 and confidence curve.
So F1 confidence curve basically tells us that trade off between the precision and recall scores.
And here we have the confusion matrix.
Uh so let us see the normalized.
So now you can see that uh the confusion matrix show us that um the model predicted uh, like in 282
cases when there was a dust mask, the model predicted correctly, while 26 times when there was the
user or the person was wearing a dust mask, the model was unable to predict anything.
Okay.
And, uh, for the glove, 551 times when the user, uh, the person was wearing a glove, the model
predicted correctly that the person is wearing a glove.
And one time when the person is wearing a glove, the model, uh, has a false positive prediction and
predicted that it has a IVR.
And, um, three times when the person is wearing a glove.
The model predicted as a protective helmet three times when the person is wearing a glove, the model
predicted as a safety vest, and one time when the person is wearing a glove, the model predicted as
shield.
So these are all the false positives.
And 72 times when the person was wearing a glove, the model predicted as a, uh, background.
Like nothing, the model was unable to detect anything, so this was a false negative.
Similarly, you can go for other classes as well.
And these are the normalized scores.
Like 92% of the times when the person was wearing a mask, a dust mask, the model predicted correctly,
while eight times percent of the times when the model was wearing, when the person was wearing a dust
mask, the model was unable to detect anything.
Okay, so 67% of the times when the person was wearing IVR, the uh, model was able to detect correctly,
while 33% of times when the person was wearing um IVR, the model was unable to detect anything.
So you can see this chart over here as well.
And over here you can see the mean average precision is continuously improving.
So we have trained the model for 50 bucks.
But you can see that uh there is a continuous increase.
So if you just train the model for 100 epochs you can see a better mean average precision score.
And uh, all this and you can see the loss is continuously decreasing.
So these are the model predictions on the validation batch.
So we have not used the validation images for training.
So it's always better uh to have a look and see how our model is performing on the validation batch.
Okay.
And the result looks quite promising.
So after training, I placed the model weights onto my drive.
So I will directly download the model weights from the drive into this Google Colab notebook over here.
Okay.
Although I have already moderates now.
And you can find the weights over here.
And.
Well, now you can see here we have the best model weights.
All right.
I will download a random image for that model testing from my, uh, drive into this Google Colab notebook.
And let's do the testing.
We are doing object detection, but the mod is not training or prediction.
So all the prediction we have a confidence about 0.25 uh, will be uh, the bounding boxes will be drawn
around them and we want to save the output.
And we are just using the best model weights we have got from the training.
And then, uh, the test for the test we are using this image, one which have downloaded from the Google
Drive.
Now you can see we are able to detect the protective helmets, but the gloves are not detected.
Also, if we train the model higher epochs, results might work.
So now test on some other image as well and see what results we are getting over there.
So now you can see over here we are able to take the safety vest.
Protect the valve was a safety vest protective helmets.
So the result over here looks quite promising.
So now we will download some random demo videos from the drive into this Google Colab notebook.
And let's see what results do we get on this demo videos.
So now you can see over here I'm doing testing on these demo videos over here.
On.
Let's see how does it works.
Now you can see that the complete video is being divided into 310 frames, and we are doing object detection
on each of the frame one by one.
And in the output we will get the combined, uh, output video.
Okay.
So meanwhile the object detection on this input video gets appeared.
So it's done.
And I have already, uh, displayed the output video over here.
So let me just download this.
Okay, so it's downloading.
Let me navigate my screen towards the outward.
Let me show you this.
Well, now you can see where here we are able to take the safety words.
Uh, protective helmet, protective boots.
And the results look quite promising to me.
And these are the good results.
Okay, so.
In the same way I tested on the other video as well.
And, uh, here we have the results over here.
So let me just, uh, download this as well.
Okay.
Let me navigate my screen towards it.
So now you can see that this is another video.
And we are able to detect the safety valves protective boots.
Very good.
The result and look very promising to me.
Uh, so that's all from this tutorial.
Thank you for watching.
Bye bye.