How to train a YOLO v5 on a Custom Dataset - Object Detection

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone i'm pianicola cto and co-founder at pixelia and today we're going to talk about yellow algorithms for those who don't know what yolo is it's one of the most famous object detection algorithm that has been achieving state-of-the-art results for a few years now the goal of this short video is to teach you how to train a yellow v5 easily but first we will quickly explain the theory starting with the evolution of object detectors over time what really is yellow and how it's different from other object detectors how it performs yellow v5 in depth and finally how to train yellow v5 on your own custom data set let's go there are a few types of object detectors rcnns and ssds our cnn or region convolutional neural network are older and are an example of two stages detectors the two stages are a selective search that proposes region so bonding boxes that might contain objects and a cnn used to classify this region as you can see in this figure the two steps are done sequentially which can take a lot of time the problem is that this first implementation of rcnn in 2013 was really slow this left a lot of room for improvement and that's what have been achieved with fast rcnn in 2015 and later faster rcnn that replaces the selective search stage with an rpn region proposal network which finally made rcnn an end-to-end deep learning object detector this family of detectors are usually very accurate but still very slow so researchers came up with a different architecture called single shot detectors which shallow is part of what makes those algorithm fast is that they simultaneously learn the object's coordinates but also the corresponding classes the counterparts that they will be less accurate than our cnn but really much faster that's the philosophy beyond yellow and the many iterations it has known over the years today we're going to focus on the last one to date yellow v5 as you can see in this graphics it really performs well even against efficient debt which is exponentially slower as you choose a higher version of it as we can see there is multiple version of your v5 itself it goes from small to extra large with obvious differences in weight performances and latency this is a good thing because we can choose a version that is either very fast but less accurate two versions that are good compromises between latency and precision and a heavier version that will perform better now that we know more about yellow and the main differences with other algorithms let's train it welcome to pixelia for the record pixelia is an end-to-end ai development platform that allows you to create and version data sets annotate your data organize your work with projects track all your experiments save your files and finally deploy your models all in the same place i'll start by showing you the data set that we will use for our tutorial so this is data set for object detection as you can see it is already fully annotated with five different classes which are different types of grapes let's take a look at the annotations we can clearly see that the data set is well annotated with every grape inside bonding boxes just like this now for the sake of simplicity i don't want to create a model that can detect those five classes but rather an object detector that can detect grapes so what i want to do is to merge those five classes into one class that would be called grape and create a new dataset version with it first i'm going to select all my images just like this and create a new data sheet version with no labels [Music] here i can see that i have two versions of my data set now let's choose our newest version now i'm going to set up the labels so the only one class we want is grape okay fine so now our label is well defined what we're going to do now is to import the annotation from our old data set into this one and merge the labels just like this i'm going to select the output label i'm going to put all the old label in this one merge into grape execute now i just have to wait until the merge is finished okay now we can clearly see that we only have one label with 3920 objects if we take a look at the annotations we can see that albumin boxes with all the different types of grapes are now only one type which is grape and we do have all our objects here or here let's get down to the real business and train a yellow v5 on this data set what i'm going to do is to create a project called yellowcratetest that will use this dataset and organize my trainings okay i don't have a team all right let's check our project so our project is pretty empty now what we're gonna do is to attach the data set we just created in this project so this is the one and we want the grape one version here it is our data set is now well attached before creating our experiment i will show you the model section of pixelia on this page you can find every model that we uploaded that our base architecture that you can use to kickstart your experiment such as yellow v5 efficient faster or cnn or whatsoever so for our experiment i'm going to use a yellow v5m model for the sake of speed of training okay what you have to understand is that you can use this model out of the box it means that you don't have to do anything just select them this is what we're going to do now so i'm going back to my project and i'm going to create an experiment using this pre-trained yellow v5m model as this is the first version of our training i'm going to call it v1 and i'm going to choose the model from my organization model hub so as i said we're going to choose a yellow v5m so this is this one okay to run yellow v5m we just have to set up two parameters the number of steps or epochs and the batch size so for this tutorial and to show you quickly how it goes we just we will just set up a hundred of epochs so the parameter step will be 100. we will run it in a collab so i'm going to set up a small batch size okay it will be uh one just for the test and we will run on large hardware later and i can select the data set so our famous grape one that i set to set up the experiment okay let's create it now this is the experiment overview this is the dashboard of your experiment so as you can see we do have our base model here it is we have attached our data set and our parameters are set now the beauty of pixelia is that i can just go in the launch tab click here okay this is a preconfigured jupyter notebook with all the things needed to train a yellow v5 so i'm gonna quickly show you all steps needed to launch the training so first we have to install the pixelia package along with the pixela yellow v5 package we have packaged in this library the whole pythos implementation of yellow v5 um so we just have to import the packages along with pytorch or subprocess this is our experiment name v1 so we have to leverage the experiment system of pixelia to get all the files uh we have from our pre-trained network and the parameters so with the checkout we can we can get everything on the instance download the annotation along with the images we set up a directory that will store our images and annotation this is the train test split okay so we have to generate a yaml that will contain the label map along with the directory the path of the train and test images so this is what is done on this and this lines then we have to set up the hyper parameters that will be used for training so the only things we have to give is uh the parameters we set up from pixelia the label map and the experiment name and then we can launch the train loop i already launched it in order to show you something because it's quite slow on jupiter cpu notebook but as you can see the training is going pretty well actually and everything is sent back to pixelia live just like this as you can see i already have my training matrix in live and if i refresh the page i should have some more values with the new epochs perfect now as it would be too long to wait for the training to finish and to show you real result with a longer training i set up another experiment that i will show you here that has a thousand epochs and a strain on a nvidia v android gpus so as you can see the metrics are pretty good we do have problem with our loss here we should investigate it later but as you can see it does converge a little bit now let's see result with evaluation on real images from our data set so what i did is that i log the images from my evaluation on different batches of images so we can see later i downloaded one of those images and here it is what we can see is that we have just a thousand epochs of training which took approximately four hours we do have already some great results for our great detection algorithm if we go check the files of our experiment we can see that we have successfully uploaded all the files needed to resume our training later we do need the config file so this is the this is the yaml a checkpoint file for hyper parameters this is this one and another checkpoint file which are the pythos weights so now we can resume our training whenever we want and iterate over and over on our experiments easily using pixelia that was pionicola for pixelia thank you for listening don't forget to register to pixelia if you too want to accelerate your deep learning projects if you like this content you can subscribe to our youtube channels and go check our major articles to always learn more about how we can experiment faster using pixelia see you next time
Info
Channel: Picsellia
Views: 12,113
Rating: undefined out of 5
Keywords: yolov5, computer vision, custom dataset, deep learning, ai, picsellia, ML, object detection, object detection training tutorial
Id: 7sGjmBNU6vI
Channel Id: undefined
Length: 11min 33sec (693 seconds)
Published: Wed Mar 24 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.