road pothole detection | yolov8 custom segmentation | yolov8 road pothole detection

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends and welcome to YouTube channel Freedom Tech and in this session what we are going to learn in this session we are going to detect Road port hole with the help of YOLO vate segmentation model we are going to create our own custom segmentation model with the help of Robo flow so before we move to our practical friends if you learn something from our videos please consider to subscribe our Channel okay friends thank you so much and let's get started so friends today we are going to detect a road portol with the help of y v segmentation also we are going to draw a polyline on each Road port hole instead of drawing mask we are going to draw here a polyline of each Ro Poole size simple so for that first we want to install here our basic packages so let's just open our Tony python ID just open Tony python ID then go to the tools manage packages and search for for open CV hyen python then just hit enter it will search open CV hyphen python first package then simply click on install button it will install open CV on our Windows 11 machines you can use your Windows 10 machine also then we need ultral litics package so ultral litics ultral litics just hit the enter button it will search for ultral litics first package click on install button done then it will install ultral package on our Windows machine that's it so we have done with package installation process now simply for today's session I have create a new repository I will mention the link inside description box you need to Simply copy paste the link inside the browser then Yol at Road portol detection this is the repository name then go to the code click on download zip and it will download our ZIP format repository as you can see it's now downloading so friends we have done with downloading our repository simply open download folder download folder and here it is what our repository right click wiar extract as a folder and we extract our repository so go inside our repository and first let's just watch our video file so p. MP4 this is what our video file and as you can see this is what the road and there is a lot of road portoles so our goal is to detect the PO hole with the help of yoat segmentation model as I mentioned instead of drawing The Mask we are going to draw here a polyline on each Road port hole means we are going to draw a polyline on each Road pot hole size for that we are going to use here a robo flow so this is what our video file as you can see this is what our video file done now simply for creating our own custom object detection model we need our data set so for data set as I mentioned simply we are going to use here a roof flow now simply I will open roof flow website so now simply visit roof flow website so as you can see roof flow just click on the website and this is what the dashboard here simply we want to sign up with Gmail ID so I already signed up so just click on sign in and then it will open a dashboard as you can see it will open a dashboard so simply we are going to create here a new project so just click on create new project and then uh we are going to use here instant segmentation model so simply select here instant segmentation and mention the project name name so let's just say yolow V at seg you can mention any project name as per your requirement so just select instant segmentation and mention the project name and annotation group so here what we are going to detect means what is our class so our class name is basically Road p hold so mention it Road hyen p hold so this is what our class name so project name is Yolo at SEC you can mention any name visibility is private and annotation group is Road P Hole Road uh port hole and then instant segmentation then simply click on create private project so it will create our project now here we want to drag and drop our images or if you have a video file for your project so simply you need to drag and drop the video file so we have our video file inside our repository so just open our repository again so our repository is yolow V Road P hole detection main again same and then this is what our video file p. MP4 so just drag and drop here just drag and drop and then it will create a images as you can see so basically for this video one second the output size 28 images so it will basically create 28 images from this video file so just click on choose frame rate so now it's creating or we can say it's basically capturing the images from video file then as you can see now we have our images uploading files so we successfully upload our video file and then we use a roof flow drag and drop service which basically capture images from video file so we have now our images 28 images so simply now simply click on here assign images so just click on assign images tab and now this is what our images unannotated 28 images and annotated zero because we want to create now annotation so simply click on start annotating process just click on start annotating Tab and then this is what our first image as you can see 1 by 28 so this is what our first image so now because we are going to use here a segmentation model so we are going to use a polyline method so this is the polyline method as you can see polygon to first second and third so third one is polyline tool so just select it polyline tool and then we are going to draw a polyline on each Road port hole so like this way let's just say this is what my first port hole so if I want to draw a polyline on this port hole so let's just start from here like this way start from here then here then here then this is the next next Point next Point next point then next point just use the mouse left key just use Mouse left key and so now this is what end as you can see this is what end now simply I want to end the poly line so this line I want to merge inside the rectangle where we start as you can see this is the white color rectangle so if I merge this line inside this rectangle angle it will become green it means we have done so just press the left button of our Mouse and then you will see this kind of editor as you can say annotation editor and this is what our class Road port hole just click on Save that's it we successfully draw a first polyline on our road portal and here it is as you can see the classes Road pot hole one so if you move your cursor on this class as you can see there is a white color class name here here you will see a white color class name Road portal so same way now let's just say for this port hole press left button of our Mouse press it so this is what where we start as you can see there is a white color rectangle now simply move just just draw the line here then again press the left button then you will see see a next rectangle then again draw the line here then again press left button of our Mouse then you will see next rectangle then just go here press the left button of our Mouse then just go here then just go here and merge the line inside where we start the rectangle and then you will see the rectangle become green just press left button of mouse then you will see annotation editor same way just click on Save and then you will see we have now two Road Port holes if you move your cursor on the road port hole as you can see there is a two Road portal so same way for this one just start from here go here press left button Mouse then just go here press left button of our Mouse then just go here press left button of mouse then just go here press left button of mouse then just go here press left button of mouse then go go here press left button of mouse and then just merge where we start the rectangle become green then you will see annotation editor class name just click on Save now we have three color uh three Road portals means we basically draw a three polyline on three Road portal so same way we want to continue this process for each image we want to draw a poly line which I have mentioned here the process simp so let let's just say for this just start from here here here go here here and then just merch then just click on Save now we have four Road port hole now let's just say for this one so let's just start from here here here here then here go here and then just merge it click on Save Editor now we have five poly line on road P hole so this is how I will draw a polyline on each port hole for each image so it will take some time meanwhile I will pause video as soon as the process completed I will start video again so friends we have done with drawing polyline on each image on each portal as you can see this is what our last image 28 so now we have done with image annotation process now simply we want to click on this yolow V8 hyph 6 this is what our project name as you can see yellow V8 Hy SE just click on it and then you will see this kind of page that's it now here we want to click on ADD our images as a data set so just click on ADD 28 images as a data set then just click on ADD images now it will add our images as a data set as you can see we have one job with 28 images done now simply here as you can see click on generate tab here click on generate Tab and then you will see this kind of a page just click on continue then just scroll down again augmentation click on continue then just scroll down in create section just click on create now it will create our data set so we have done with our data set now simply we want to open our Google collab file so just open Google collab and then click on upload go to the browse and inside our repository this is what our repository inside our repository we have I have mentioned the file the Google collab file for YOLO instant segmentation so just select it click on open and then it will upload our collab file on Google collab so as you can see it's now uploading so friends we have done with uploading process so just go to the runtime change runtime type select Python 3 then select T4 GPU then click on Save done now simply click on connect it will connect with Google collab so friends we have successfully connected as you can see T4 RAM and dis now simply we are going to run our cell one by one so let's just start with first sale just click on play button it will start our first sale done then next sell import OS done now we are going to install ultral litic package so just click on play button it will install ultral litics with version 8.0.1 196 done as you can see we have successfully installed ultral litics now we want to import our packages or we can can see the module so just click on play button then now we are going to cross check if we successfully install allytics on our Google collab for that we are going to use a roof flow image which is basically doc. JP the dog. jpeg image from media. roboff flow.com so just click on play button now it will detect the object from our image uh the image name is basically dog. JP done as you can see we have one car one dog and one backpack and one H hand handb back basically so here it is as you can see this is what our image and we have detection we have segmentation also we have rectangle also simple now here on this section as you can see for this shell now we want to import our uh robo flow code so simply open our roof flow and then just click on export data set just click on export data set and then just here we want to select yellow V format as you can see I have select yolow V format this one here it is as you can see yellow V so just select it yellow V and then click on continue it will create a zip format file as you can see it's zipping files done then you will see this kind of Windows small your download code so from here we want to copy the code from roof flow import roof flow like this way just copy it like this way just copy it copy open collap file and then just replace with this code code just select delete press cr+ V and then it will past our new code it will paste our new code from this window which we just copied done now simply run this code done as you can see we have successfully run our cell now simply just click on this folder icon just click on it and then as you can see we create here a data set folder so inside data set folder we have our project project folder as you can see yellow we seg one just click on again and then inside that we have train and valid folder train and valid folder if you click on Trend folder then inside that we have images and then inside that we have a labels also labels also simple now what we want to do we want to open data. yl file so just double click on data. yl file and then you will see this is what our text file as you can see this is what our file so here we want to change this train and validation path so just go here in train right click to Trend folder copy path and then just move here and remove the trend path and just press control+ V it will paste our new path then same for valid just remove the old path go to the valid folder right click copy path and then just press control+ V done now simply press control+ just as you can see the my cursor is basically over here so just press contrl Plus s it will save our data. yl file just close it now we have done now we can simply start our training process here as you can see the model which we are going to use here yolow V8s hy. PT you can simply mention here YOLO V8 Nano model also so you want to Simply mention YOLO V8 n. set. PT it will create a segmentation Nano model so right now we are going to use here yolow V at s hy. PT so I have mentioned S as I mentioned if you want to go with yolow V at n then mention n but now we are going to select here yolow v s uh segmentation PT model and the then the apox which we are going to use here 100 done now simply play the cell it will start our process and friends as as you can see it start our process means there is a apox process one out of 100 so our training is started it will take some time meanwhile I will pause video so friends as you can see we have completed our training process and our model is save inside runs segment and train folder so this is our runs folder then we have segment folder then we have Trend folder and inside that train we have weights folder and best. PT this is what our model so just click on this three Dot and click on download it will download our best. PT model so friends we successfully download our best. PT model now minimize all these things and just open our repository inside downloads as you can see we have our b. PTM model inside downloads folder so first we want to move our model inside our repository so right click cut and our repository is yellow we Road Port detection hyph main again same folder and then just paste here our model now simply we are going to open our test. PI which is our python code and here as you can see I have mentioned best. PT model then here we want to mention our video file name so our video file name is basically p. MP4 so let's just say p. MP4 MP4 that's it then uh we have our results is equal to model. predict and we want to pass our IMG then from results we are going to use here a for Loop so for R in results we are going to use a boxes is equal to R do boxes and the mask is equal to r. mask then if their mask is not none we are going to create a new variable which is mask and from this mask mask data. CPU then simply we are going to to use here again for Loop and from this mass. dat CPU we are going to use numai and boxes so for seg boxes in zip mask. data cpu. numai and boxes then we are going to resize our segmentation so SE is equal to C2 do resize SE and we are going to use here with and height so width and height is basically this one as you can see IMG doep here and then we have Contours method so C2 do find Contours we are going to find the Contours for SE and then this is the method which we are going to use NP do Unit 8 and then C2 do rer external this is the method for countours and C2 do chain approx simple this is simple method which we use for Contours so then for Contour in Contours first first we need a class ID so for class ID we are going to use here this box this box as you can see and then D is equal to because this is integer so box do CLS this is how we will get the class ID simple then C is equal to class names and then inside that we want to pass this D this D this D is basically class ID and then X Y X1 and y1 is equal to C2 do bounding rectangle method we are going to pass our Contour this is how we will draw a rectangle using our cont method and then we are we want to draw here a polyline on each portal for that C2 poly lines where we want to draw a poly lines we want to draw a poly line on image then we want to pass here a contour as you can see Contour and then true then the color for polyline and then the thickness that's it and then we are going to put our text that's it so here let me show you here here I have mentioned the class name as you can see the class name this class name is basically model do names and then the class name variable which we call over here which we call over here here it is simple so now just save the code and if I run the code and as you can see there is a poly line on each Road port hole and there is a text on the each polyline we are detecting here Road P holes we create our own custom model and it's now detecting the Road Port holes as you can see we are drawing a polyline on each Road port hole on each Road port hole we are drawing a polyline because we mention here we want to draw here a poly lines with the help of our Contour method that's it now let's just say if you want to draw a rectangle so I have mentioned here rectangle method also so if I save the code and if I run the code let me stop the polyline method now it will draw a rectangle just save the code and if I run the code as you can see now there is a rectangle blue color rectangle on each Road portal but but if we draw a poly line if we draw a poly line on each Road P hole it's look really good it's look really good that's why I have mentioned here a polyline method let me start a text method Su to.put text method and as you can see so this is how friends we can use a roof flow and we can create our own custom model for yolow we segmentation and as you can see we create our own model and we are detecting Road Port holes also we we are drawing here a polyline on each Road poort Hole so I have mentioned the full code inside the GitHub repository so we will meet our next video till then thank you take care and bye-bye
Info
Channel: FREEDOM TECH
Views: 1,814
Rating: undefined out of 5
Keywords:
Id: Fe8W2lNTnU4
Channel Id: undefined
Length: 25min 42sec (1542 seconds)
Published: Wed Jan 31 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.