The first step and the most important step, which is data gathering.
So we need to gather the images of potholes.
Then we need to annotate those images and then we will train our YOLO segmentation model on those pothole
images.
So our trained YOLO segmentation model can detect the potholes from the images or the videos.
So in order to gather the potholes images, we have found those this image dataset on Kaggle.
So this dataset contains multiple potholes images which you can see on your screen currently.
So we have around the 618 potholes images in this dataset.
So I will just download this dataset.
To download the dataset you need to have an account on Kaggle.
So I have created an account so you can create your account on Kaggle as well and download these images
from Kaggle.
So this is the pothole images dataset.
So in the first step I will download these images, then I will annotate these images to annotate the
images.
I will use Roboflow to annotate these images.
So the currently the dataset is being downloaded, so it might take some time.
Okay.
So as these images gets downloaded then I will unzip this folder and then I will upload all these images
onto the roboflow and then we will annotate all these images and then it will train our YOLO V8 segmentation
model.
So the dataset is about to download.
So let me open the roboflow in the meanwhile.
So just write roboflow over here.
So if you haven't created a Count Rover Roboflow I recommend you to create an account on Roboflow So
using Roboflow we will annotate these images portable images.
So if you haven't created your account you need to sign up.
But as I have created my account so I just need to sign in.
Okay, so I'm just signing in, and then I will.
Okay.
So I will continue with Google.
So I've already have an account.
You can create an account as well if you haven't created this account previously.
I'm okay.
So it's just sign in.
So this might take a few seconds.
Okay, so the dataset is downloaded and if I go over here.
Okay, let me just.
Okay, so I have just signed into the roboflow.
So this is my roboflow account.
I have just sign in and this is my workplace space by the name of my workspace is mine.
You can create any name of the workspace if you want.
And just please create a public workspace.
If you create a public private workspace, you will not be able to export the dataset from Roboflow
into the Google CoLab notebook.
So it's always better to create a public workspace, not a private workspace.
So I've created a public workspace over here.
If I show you how and I tell you that this is a public workspace.
So if I go over here so you can see that the workspace is not free public plan.
So this shows that the my workspace is on a free public plan and I can easily export this dataset from
here to into the Google CoLab notebook.
Next.
Let me show you the images over here.
So just give me a minute.
I'm just navigating to the folder where I have the images placed.
Okay.
So I have this place, this image dataset.
Well, I have placed the image zipped folder over here.
Let me just show you.
So now you can see this zip folder, which I have downloaded the images from Kaggle.
So just unzip this folder over here.
Okay, so this might take a few more seconds, so let's wait and see.
Okay, so this is the unzipped folder and it contains all the pothos images which you can see over here.
So these are around 616 images.
But as we are just training and testing our models, so we'll only take 96 images and then we will annotate
these 96 images and then we will train our YOLO segmentation model on these 98 images.
So let me go back to my Roboflow account and let me upload these images over there and let me annotate
these images.
So first of all, I will click on Create New project.
Okay.
So basically.
As I am doing instant segmentation.
So I will just select instant segmentation from here.
And what I am detecting is potholes.
I'm just writing potholes over here and write here potholes, segmentation.
So this is the name of my project Pothole segmentation and detection and segmentation.
Basically, we are detecting the potholes and doing the segmentation as well.
So this is the name of my project and I will create a public project.
So the dataset which will be available to public so anyone can access this dataset through your Roboflow
universe as well.
So I'm just creating a public project, so this might take few seconds.
So let please bear with me and let us create a public project over here.
So project type instant segmentation, what are you detecting?
Potholes, project name, potholes, detection and segmentation.
And I'm just creating a public project, so this will take a few seconds.
Okay.
For the project.
A public project is created over here.
You can see that the project name, potholes, detection and segmentation.
So now I will upload the image dataset from here.
I will just go to YOLO V8 folder.
We have the pothole images.
So just.
Okay, so here I will just upload these images around.
Let me upload 100 images and this will be enough for training the segmentation model and testing it
that whether our model is able to detect the potholes or not and do the segmentation of the potholes
or not.
Okay.
So let me just upload.
Okay.
So just let me just upload the 98 images.
Okay.
So the first step am uploading this images into the robot.
So then in the next step I will annotate all these images.
Okay, so.
Just click on Save and you can continue.
So currently you can see that all these images are not annotated like 98 images.
All of these images are not annotated.
I will annotate all these images and explain you all these things.
So I will annotate all these images one by one.
Okay.
So currently you can see that all these images are not annotated, but I will annotate all these images,
so don't worry.
So as am on the only one working on this project.
So I will assign all these invitation to myself.
But if you have a group member or a fellow working on this project, on any project with you, you can
invite your teammate and assign some part of the images to him to do the annotation or remaining you
can do yourself.
Okay, so as I am only one working on this project or this tutorial, so I will assign this images to
myself.
So now I will do the annotation of all these images.
So it's currently annotated and illustrated.
98 images are unintegrated and zero images are annotated.
So as we do the annotations, the number of annotated images will increase.
So let's me click on the first images and do the annotation over here.
So to the annotation, you will just need to click on the polygon tool over here.
And just so here we can see a pothole.
So just click over here, here, here, here, here.
And then here we are just getting up.
So in this way you will do the annotation.
Okay, so I can see a pothole over here as well.
So just let's do the annotation over here, okay?
So in simple detection, we just draw a bounding box.
Okay, Just create a rectangle bounding box.
But in case of segmentation, we need to do this type of polygon annotation, which you can see over
here.
So there are two potholes in this images.
So we have annotated both and okay, so let me add the label say okay, so you can see that this is
the first pothole and this is the second pothole.
So in this way I will do and create my second image over here.
So just go over here and just click on this.
Click on this, click on this click, click, click, click, click.
Okay, so let me see.
Okay, Just click on Save and Enter.
So now you can see that we have a pothole over here.
I cannot see any other pothole in this image, so let's go further.
Okay.
This one is a big pothole.
Okay, So just do it.
Do it, do it, do it.
Now that's good.
So in this way, I am just annotating all these images and the label which I am assigning is potholes.
Okay, so next I will annotate this image.
Okay, so in this way I will annotate all the 100 images one by one.
Okay.
So you can see that I've entered this image as well.
So now let's annotate this image.
Okay?
This image contain many potholes.
Okay, so let me annotate these images as well.
Okay.
So let's annotate this image as well.
So let me create this image as well.
Okay.
This part of the image is also annotated.
Okay, let me annotate this as well.
Okay.
And the label which we are assigning is pothole over here.
Okay.
So in this way I will estimate all the 98 images one by one.
So this is a quite time consuming process.
So I'm just pausing the video and let me annotate all these 98 images like I did for the first five
and then I will be back and then we will generate, uh, generate the dataset and then export this dataset
into our Google CoLab notebook and train our YOLO segmentation model on the potholes dataset.
Well, now you can see that all the images are annotated.
So if I click on here, like you can see that I have annotated all these images over here.
And if I click over here, you can see that the images are annotated like where we have the potholes.
We have drawn the mask over here.
So in this way we have annotated all the 96 images which you can see over here.
So all the 96 images are now annotated.
So let me just go to generate and generate this dataset.
So now you can see that we have only one class, which is part one.
We have 96 images.
All the images are annotated and uneducated images.
Zero.
The 84th 84 images are for training, while images are for the validation.
And we are not taking any images for the testing.
But if you want, you can just set it.
Let me just do a rebalance.
You can just click on rebalance and let me just set it as okay, so 76 images are used for training,
15 images are used for the validation and five images are used for the testing purpose.
Okay.
So in this way I have set the class balance as training images contain the 79% images, 16% images are
in the validation portal and 5% images are in the testing folder.
So you can rebalance it as per your requirements.
Okay, now.
In the pre-processing we can always pass as a pre-trained modular V8 segmentation model.
Segmentation Pre-trained model is being trained on coco dataset and the image size which is default
is 640 cross 640 So it's always better to set the same image size or because we are just fine tuning
the YOLO segmentation model on the potholes, the images.
So it's always better to set the image size as 640 cross 640 because if we increase the image size or
less the image size, then we are basic, then we may compromise on the accuracy.
Okay.
So just so if your data set is not very much large, so it's always better to do the data augmentation.
So data augmentation not only increase the size of the data set, but make the model resilient.
Okay as well.
So I will do two annotations.
I will just add one is the this, I will add two annotations.
So let me just add this data annotation.
So okay, no, I don't think this will work very well.
So let's see other annotations as well over here.
So let's just add this rotation and rotation like my single images will be.
So from a single images, two images will be generated using this rotation augmentation.
One will be one will be with -15 degree shift and other will have a plus 15 degree shift.
So from a single image, two images will be generated, one with a -15 degree shift and other with the
plus 15 degree shift.
So let me apply this and let me only consider this on this augmentation.
So now I will generate this images.
So now you can see that as I am generating these two two images from a single image using rotation with
-15 degree and plus 15 degree.
So now the dataset size has increased now.
So if I click on Generate, it will generate my dataset.
So then I will be able to export this dataset from Roboflow into the Google CoLab notebook.
Now clicking on generate and creating my dataset, finalizing my dataset so it will create the first
version of the dataset.
You can add more images into the dataset as well and generate a new version with it.
So now you can see that this is our version is generated, so the data augmentation is only applied
to the training set and the data augmentation is not applied on the validation set and the testing set.
So now you can see that like this image, we have a -15 degree shift like we did in the using a data
augmentation rotation technique.
And here we can see the plus 15 degree shift, which we did using the data augmentation rotation approach.
Okay.
So now we will just export this dataset from Roboflow into our Google CoLab notebook.
So just select a format.
You can select either select the YOLO V8 or YOLO V5 PyTorch format because both these versions were
released by Ultralytics.
So using Yolov5 PyTorch format, you can also export this dataset from Roboflow into the YOLO Google
CoLab notebook and train the YOLO V8 segmentation model.
So also train a model from label with don't want to train the YOLO segmentation model using Roboflow
will train the YOLO segmentation model with one my Google CoLab notebook.
So just unselect it and click on continue so it will generate some python code.
So using this python code, I will export this dataset from roboflow into my Google CoLab notebook.
So it's zipping the files of that dataset image.
So this might take few seconds.
So as the dataset is prepared, then we will export this dataset from Roboflow into our Google CoLab
notebook, and then we will train our YOLO segmentation model on this.
Potholes Images dataset.
Okay.
So this might take some time over here.
So I'm just waiting for it to get repaired.
And then I will export this dataset from Roboflow into the Google CoLab notebook.
So here I have the download code.
So using this download code I will export this dataset from roboflow into my Google CoLab notebook.
If you are trying to implement this project on any other like PyCharm Anaconda Navigator or Visual Studio
or Spyder, you can use this terminal command over here.
But if you are doing on the Notebook like CoLab Notebook or Jupyter Notebook, then you can use this
download code over here.
But if you are doing in PyCharm or Visual Studio or you are doing in Spyder, then you can use this
terminal command from here.
Okay, so in using this code, I will export this dataset from Roboflow into my Google CoLab notebook.
So in the next part we will see how we can train YOLO segmentation model on this Potholes images dataset.
And let's go towards the next part and let's train our YOLO weird segmentation model on the Potholes
images dataset which we have prepared in this video tutorial.