How to train YOLOv8 Object Detection on Custom Dataset | step by step Tutorial | Google Colab

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign [Music] object detection model using yellow V8 yellow V8 is the latest release in the yellow Series so it is it is designed by ultralytics it is the same team responsible for yellow V3 and yellow V5 so this is the GitHub wrapper of yellow V8 you can see and they have created a documentation for Euro V8 so it has quick start guide it has information regarding detection segmentation classification so yellow V8 can perform detection task it can perform segmentation and classification as well so we'll be using this detection guide and this quick start guide for our project this is the quick start guide and this is the detection guide if you want to perform detection then use this command line command line by yellow task equal to detect then model equal to train so if you want to do classification uh put task equal to classify for segmentation task put as equal to segment so in each operation whether it is detection or classification or segmentation we'll be training the model will be predicting the model uh predicting on by using the model will be doing the validation and finally we will be exporting the model the same thing can be done using python API you can see the code here so in our project we'll be working with the detection model and we'll be using command line interface so this is for quick start guide and this is for detection as you can see so this is classification detection and segmentation you can see the difference between the stocks you can see here right now for our model for our project we'll be working with this data set you can download the data from this link I will be giving the link in the description in this data set it has like uh images with The annotation files you can see this is the image this is The annotation file for that particular image and here we have two classes one is player and second one is football now let's go to go to our Google Drive so download the data from this link then go to your Google Drive create a folder that is solo VA and within that create a folder that is data and upload everything that you have downloaded from uh from this link here so download data from this taggle uh kaggle link and upload everything inside this folder then create another folder that is output so here we'll be saving our like prediction on images on on videos then after that here we have some images on which we'll be doing the prediction then here so in this folder we'll be saving all the files that will be generated during training then here we have some videos like some four videos here we have another video folder so we have total number of eight videos four in this folder and another four in this folder now this is the data set.yaml file and this is the training notebook be sure that you are using GPU so go to change runtime and select GPU here and save so first do the PIP install ultralytics so PP install italytics if you run this so run anyway it is downloading everything all the required libraries and it is installing so you can see it is installing all the packages that are required for uh for your low V8 after that we are importing uh some other libraries here then we'll be connecting our collab to our Google Drive so it will connect the call up to Google Drive then select the account you want to connect and then allow you can see our Google Drive is connected after that here we are we are creating path for training and validation data the whole idea here is we are creating Trend folder file folder according to the requirement of yellow VA and then we'll be taking data from this folder we'll be splitting the images with The annotation files into it 80 and 20 speed so 80 percent will be for training and 20 percent will be for validation and then we'll be placing those images and The annotation files inside the Strand and value folder respectively so let's run the function here it is doing all those things it is creating this directory it is taking the data from here and splitting into you know 80 and 20 split then it is placing inside the respective directory so it is done after running this thing you will be getting a folder like this so you know data you can see here so the directory would be yellow data images and Trend your data images and trend so inside this folder we have all the images for training then close this one and Val so inside this folder we'll be having all the images for validation and then levels inside this folder we'll be having all The annotation files for the images that are present in the trend folder so for for inside images Trend will be having the images enter labels and Trend will be happening having The annotation files for those images so this is the folder structure We are following here after that after creating that now create the dataset.aml file so I'll be sharing this data center DML file with you in the in the GitHub so you can find the file from there or you can just create the file simply so here if you open the dataset.aml file drive go to mind drive then here we are doing yellow V8 then dataset.yaml you can see so here we have two classes that is player and football you can see so player has index 0 that's why we have placed a player at the beginning and after that we have football then we have number of classes too and this is the directory for the training images and this is the directory for the validation images you can see if you are confused about this directory you can go here and okay close this one select yellow v data then images now copy the path here and paste it here do the similar thing for validation so after that save the data set dataset.yaml file and close it so close this one close this one we have created our training data validation data we have created our data serial DML file now let's move on here we are importing Alternatives so it will perform some checks and it will find out the CPUs RAM and GPU available after that you can see we have seen this uh seen this command line here so in detection if you are using not here actually here yeah this one so this is the same thing now to train the model use this command confine the command here so to train the model yellow detect Trend you can see here we are using the same thing here yellow task is detection mode is Trend because you are training the model model is yellow Fiat small if you want to find a different models that are available for yellow V8 go to the GitHub repo you can see here and you can find different different model for different event tasks so for detection we have yellow V8 n yellow V8 is m l and X for segmentation task also we have different different model and for classification tasks we have different different model we'll be using this yellow V8 small model [Music] okay so you can see this is yellow weird small dot PT then data data here give the part to dataset.aml file go here go here like drive going to mind drive then yellow V8 and inside that we have data center ml file copy the path and paste it here so inside this this dataset.aml file yellow V8 will figure out where to find Trend images where to find annotation images annotation for those train images where to find validation images and their respective annotations after that we are going for 10 number of epochs here after that we are selecting an image size of 640 then batch size 8 project so here we are providing the directory inside which all the files that all the graphs the training loss graph the valuation loss graph all the augmentation uh images that will be generated during training will be stored so inside this directory another folder will be created that is football and inside that folder all these all these files will be stored so we are using that so this is the command line we are using now let's let's run the command line it has download the void file you can see here and it is using this word file for the fine tuning you can see the training has started here so currently we are at Epoch one so it is training is going on now we are going to EPUB 2 we'll check it up to 10 number of epochs in the meantime let's go to this page so here you can see you can see like we are using batch equal to 8 project equal to this so we have used some parameters here during training you can see the batch image size epox if you want to use other parameters that that can be helpful uh during training you can find all those parameters here so this is this is within Ultra latex you will find another folder let's go back to Alternatives first okay so this is the data repo then go go into alternate text and then inside that going to Yellow then inside that going to CFG and default.yml file so here you can find all the parameters that can that can be used during training you can see project name verbose here then single class image words everything so you can you can experiment with all these parameters or you can do the experiment with some of the parameters then you can use these parameters for validation and this during prediction you can see here then these are for export these are the hyper parameters available for yellow VA if you can play around with the hyper parameter to to get a better model you can find the similar information inside this documentation so here we have configuration go there you will be having a definitions and all those parameters here also now let's go back to our training our training is finished and you can see the model has completed the validation also so it has performed validation on on this number of images you can see and all the results will be saved inside this folder let's let's go back to the drive so this is the yellow V8 and within this folder we have football you can see So within that inside that we have all the other documents that are generated during training you can see here and within this weird folder we have best weight and last week now let's do the prediction so during inferencing you are using this command line so task is detect because this is a detection model and mode is predict model so here we can find our model you can see just a second yeah you can see so this is the location of our best model let's just copy the location here and paste it here so paste it here now we are using a confidence threshold of 0.35 you can use either 0.35 or 0.55 or 75 according to your requirement then source is this test images so we have some images inside this folder we have already discussed this inside this folder we have some images you can see here let's let's run the detection on those images so it is sending the inferencing on those images you can see the sixth number seventh number now the detection is completed on those images and the results are saved inside this folder so this is the folder you can find here this is not inside our Google drive this is this is on the RAM memory of Google collab so here you will find all the detections ready you will find all the detections let's move all these images from here to this folder so inside this folder we'll be placing all the images to do that let's run this command if you go into this folder so you can find all the images after prediction you can see we have bounding boxes with this code let's check this one so you can say we have football it has detected the football jersey with the players you can see here now let's run the detection on videos let's run the command now it is doing the detection on videos okay okay it is loading now detection has started here the detection is completed on these videos now let's run the command to copy these videos from collabram into Google Drive so this is the folder created inside this we have our videos after detection let's just watch these videos so you can see it is rotating all the players you can see here it is also detecting the ball deleting the football even if it is in the air you can see with the probability of 72 that is good this is the second video you can see it is to checking the football it is in the players with with good accuracy and this is the third video here the detection are good here so our model has been trained for only 10 number of epochs and after that it is giving this kind of result so the model is quite cool and here you can see like it is not detecting these players and and here also it is missing because this is a different angle of you and we have not added uh data from this video the model can be improved by adding data from this video we can train the model for more number of epochs we can play with the hyper parameters so this we have created our model our object detection model using yellow V8 I hope this was helpful please like subscribe and share I'll see you in the next video till then take care [Music]
Info
Channel: coder zero
Views: 43,986
Rating: undefined out of 5
Keywords: yolo, yolov8, object detection, computer vision tutorial, ultralytics, deep learning, machine learning, yolo deep learning, yolov8 object detection demo, object detection using yolo, yolo object detection pytorch, yolo object detection video, yolov8 tutorial, yolov8 custom data, how to train yolov8 on custom data, yolov8 step by step tutorial, how to save yolov8 weight on google drive, yolov8 prediction on video, custom vision tutorial, football detection using yolov8
Id: ZzC3SJJifMg
Channel Id: undefined
Length: 16min 8sec (968 seconds)
Published: Mon Jan 23 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.