Train YOLOv7 On Custom Dataset | Object Detection |

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello all and welcome to my youtube channel so today in this particular video we are going to discuss about yellow v7 model and orbit action model and we are going to see how we can train it on our own custom data set and before we move on to this particular tutorial let me just walk you through my youtube channel so here's my youtube channel you can you can just go and explore a lot of things around nlp and computer vision models uh so i had i have i've been creating a lot of videos on document ai majorly on extracting the important information from pdfs and also been uh putting up videos on uh the text part of the particular uh model like uh using uh clip modeling using a contrastive loss modeling using a bird model using a roberta model so a lot of models i have been displayed like a lot of applications around nlp have displayed around my videos so just go and watch it i have a lot of playlists also around training of uh of prediction models nlp models and also i have created a lot of playlists on augmentation of text data and i will also create it on videos on annotation tools that you can use it for uh text annotations and i've also created a list on hyperventilated parameter tuning so just you can just go and walk through my youtube channel to understand better and hopefully you get a lot of informative information from my channel if you like the content uh do subscribe my channel it will help me to and it will encourage me to uh prepare more a lot of content and videos around nlp and computer vision domain so uh now let's get back to the particular uh tutorial that we are going to focus today uh so today today in this particular video we are going to focus on the yellow v7 training and so yellow vsan model has been recently released and and it has been outperforming all all other objection models that are available right now so if you go through this uh github repo of your v7 which is very official and you can see that they have displayed uh the content around like how how how is the performance of euro v7 right in the comparing to other arbitration models so uh i think it's not clear here so let me just move this picture to this particular page and now you can see that uh yellow v7 which is in purple color it has been outperforming all other uh objection models uh when you compare your v5 also so if you see yellow v5 it's in grayscale uh it is able to get a better and it is able to perform an average precision about 55 percent around around 55 to 50 52 accuracy is there for yellow wheel 5 which is the latest release and it is it is unable to perform as much as better as yellow v7 but if you see you know v7 tops performance is 57 or near to about 50 uh 56.8 percent uh average positions so you can see uh they claim that it's a 120 plus percent uh faster also so if you see uh the at the bottom this particular skill shows the uh the timing the inference timing of a particular model that means how fast it is while influencing so you can see the the yellow v7 model uh it's quite faster uh as compared to the uh you know v7 euro v5 the top the top model the the heaviest model that they claim and and you can see the same performance is being delivered by the eurovis b7 with less parameters and it is able to do it at the earliest models that that it has right so so there are also a lot of varieties of v7 models that are available even for yellow v5 there are a lot of varieties you can you can just go through this getup page of eurov7 and you can just see that there are a lot of models available around the v5 and v7 also so if you want to compare more on v5 i have made a video on euro v5 also how you can drain it so the system and everything remains the same only the architecture changes has been done so like when i say system is the same that means the training part and everything and data structure around training and around the github is same as euro v5 so you can find the same folders almost same folders whatever you find it here in eurov5 or eurov7 it's all the same in there in the euro v5 so it won't be hard to change or how to uh transfer your knowledge from euro v5 to v7 while training so that's an easy part that you can get and now if you go at the bottom uh you can see that a lot of installations and training guidelines has been given and this yellow v7 is very very good at orbit actions and also recently they have also figured about figured out a way to get using uh they are able to get a pose of a particular person uh like they are able to point the key points of a particular person so in the image you can see like it is able to point out the key points like uh where is the elbow joints of a particular person i should say and it is also able to uh do an instant segmentation for the particular uh image or uh the particular image that you're training for right so eurov7 becomes a multi-purpose model and that you can use it for the keep on detections instant segmentations and of detection so today in this particular video we are just going to focus on the objection part but in later upcoming videos we are going to focus on other parts of the model like instant segmentation or key point directions so we can focus on that and we can train a custom model on that also but today's focus will be on orbitation training so now let's move move to the training part of your v7 and we'll see how we can train it so uh let me first [Music] display the data set that we're going to use so if we go into this particular data set today i am going to display a data set that will predict that will help us to break the particular person and wearing a helmet or not or wearing wearing a hard head hard helmet so if i open this particular image you can see there a lot of images available so this kind of images are will be there for our training euro v7 so you can see uh a person wearing a lot of hard helmets so that's what we want to predict today in this particular tutorial and this is also a particular person bearing hard helmet and and so likewise we are going to get like whether this person is wearing a helmet or it is not wearing helmet so that's a there's a particular uh display of a particular data set that we are going to follow today and for for annotation of this particular particular data set uh according to the euro format you can do it using a label img so the so the so the creation of this data set or annotation of its data set is same as you know v5 uh i have also covered everything the annotation part using a label img in the euro v5 video so you can just walk so you can just go through your particular video and you can just take a look on how you can annotate your data set and save the data set in a yellow v v5 format or a pascal arena you know v7 format right so it's the same way you can just go to my yellow v5 model or you can go to my yellow v5 video and you can just understand how to annotate your data set uh for for training it on your v5 and your v7 that's the same process you don't have to change anything just use the label img tool and annotate the data set according to your needs and then save it in a yellow format that's it and all of these things are covered in my europe 5 video so you can just go and walk through it now so once you have the data set right so as i told you uh this is a data set uh that we have so we have images and it's labeled so if you see so we have labels and this labels you're gonna get it from the label img once you annotate it right so you're gonna get in a dot txt format so you can see this is a dot txt for a file and you can see this is these are the labels uh of annotation in a but present in a particular uh image right so this is a bounding box information and this is the class information which is uh one two three right now is given but we're gonna define it what this one means and other other class identification means right so this is the uh images and these are the annotations for that particular images and then once you have the data structure like this uh the similar images for train and test and validation so once you have the data structure like this you can go uh to collab and you can start working with the training of particular eurovision model so now i have brought all the data in the collab with all the test and train data set and validation data set so now i have to simply start mixing up the part of your v7 or bringing the part of video p7 so uh you can skip this steps because i am trying to load all the data from my google drive and unzipping it in the particular environment now what i'm going to do is i'm going to just clone the github repo official github pro that i've shown here right i'm going to clone it and then i'm gonna go inside the your v7 folder uh that is present inside it once once the particular github is cloned then then we're going to go inside this eurovision folder and then we're going to install the requirements that are present inside it and then we're going to we are going to download the model one of the model of v7 so if you go into this particular github tutorial uh you're gonna find yellow v7 model right so you're going to download the weight of this particular uh model so you can see in this particular model you're gonna get that test size as 640 that means the image size is 640 it it has been drained on 640 image size and its accuracy is uh average position is 51.4 percent and every precision on 50 iou is 69.7 percent so likewise it has given and it has also given the average time inferencing time this is 2.8 milliseconds per image that's the that's the thing that we were talking about when we were discussing about the performance so you can see uh it is it is well it is good it is performing well at this point uh its inference time is around 2.8 milliseconds right so it's talking about here so this kind of models are available here so based on the inference speed you can select your model and you can download the weights so that's what we are doing it here we are mentioning and downloading the weights of this particular yellow v7 model so once we have downloaded this yellow v7 uh model you can see eurovision model weights are being stored you can see it's of 72 mb and now uh once we have this all set up done all the requirements for using yellow vision mod is done then we're gonna go and switch back to this uh directory of your v7 and now once you start exploring this zero v7 uh directory you can find there are a lot of folders uh a lot of files available right right now so so to train a eurovision model we are just interested and if you want to detect or you want to test the performance of your trained model you can use test dot py file and if you want to use or detect on the or inference on the new images you can use detect.pi file that's the structure you have to understand that those are the files that are required for this particular uh tutorial so now uh now once you have this data set right test train and valid now what you want to do is you want to just mention all the uh test directory train directory into one of the folders inside the yellow v7 so so there is a folder called data and inside that data folder i have created one data data dot yml file initially it was not there i created this data dot yml file and inside this data dot yml file you have to mention the path of the training data set and validation data set right so what you can do is you can just mention uh train and uh you can you can mention a train and validation key value format that's a there's a format of a yml file and then you can use and mention the path of that train file or you can also mention the uh path of the validation files and then here you have to uh mention the number of classes which means nc so here we are going to predict five classes or we are going to take five classes which and mention the names of those classes so you can see we are mentioning the uh head helmet hi this helmet and persons so like a lot of like five classes we are going to create here using this yellow v7 and this is the thing we have to uh create inside this particular data folder and you have to save it in a dot yml file so if once this informations are there you have to just use this information and to train the model right so once this setup is done uh you have created a dot yml file and now you have to go into uh the training part so in the training part you have to just mention uh python train dot py file and then you have to specify the weights so what kind of weight you are using so right now we are using euro v7 model uh weight that we have downloaded right now so we are going to mention the path of that and we are going to use the uh data right so where the data location is so you have to mention the file name that we just set up on the data folder that is data dot yml file that we have created just now dot am file so it will just help us to locate the data where it is present so this uh dash just data will help us that and then you're gonna mention the workers that means how many uh cpus or gpus are gonna use it so this is mainly for the cpu course that is that is you are trying to mention four number of cpu goes and then uh the batch size uh we are going to mention 32 and what what is the image size you want to use for training and then the configuration for that particular for for a particular model so if you're going to use the yellow vista model then this is the uh yml file that you have to use so you let let's suppose if you're going to use different model like yellow v7 w6 then you have to go inside this yellow v7 model go inside this configuration file go inside this training folder then you can choose this uh your v7 uh w6 ymr file and mention the path here right but right now we are not going to worry about that so uh and we can mention the name of that particular model for how many epochs you're gonna train it and this is the hyper parameter uh that is already available uh to train for yolo v7 so that's the basic hypermeter that is that that is present in a particular you yellow v7 folder you can just play around with those hypermeter also so right now we are just going to mention this this thing since uh with these parameters and argument around the train train dot py file and now we're gonna train this model right so let us run this particular cell to train the model for just for two epochs so the training has been completed uh we are just trained for the two epochs uh and now you can see uh you can see the status a classification report that has been printed out for each and every label which seems not to be that great because it's not print it's not getting that highest accuracy or map for each of these classes so we operating head helmet and person uh so we are not able to get right accuracy because we just we just have trained for only two epochs so maybe you can train it for more epochs but for this tutorial to keep it very short and simple uh i have trained for two epochs and you can see a lot of uh accuracies and information has be are being printed out for each and every box so if you want to further explore the performance of the model uh you can go into this yellow vsan model so once you have trained the model right so all the informations are being saved around um whatever the model you have trained it's going to save in in the folder called runs inside this yellow v7 so if you're going inside this run you're gonna find the particular folder train gonna go and explore this particular folder you can see there are a lot of a lot of information has been printed out you can see uh weight voltage also there which means this is the best weight or is the best uh performing model that has been drained on your own dataset so you can use this model or you can use this weight uh to do the inferencing and you can prepare some of awesome ai models using this particular and you can just overlay with some uis and you can prepare this you can use this ways to train your influential model right you can use this best weights for your model and then if you want to understand the performance or what is the performance of your particular training you can just open this f1 curve images so it's this particular yellow v7 model also help us to or this particular github also help us to uh store the information of the training uh of yellow v7 so you can see the lot of performance around this particular f1 f1 score uh around this particular training of this you know v7 model so you can see for each and every confidence level uh where the f1 score has gone up and where it is performing poorly so you can see i can see that uh the confidence for like 0.5 around 0.5 the f1 scores are very high for a particular class you can see for each class it has printed the f1 score and for all class average score is around you can see the purple line showing up like you can put up confidence level of around 0.3 or 0.4 of white inferencing so that's a part of uh the thing that you have to set up that's at which confidence level you want to get an uh influence right so that's that's how you can understand by this by using this f1 curve there also patient recall curve that has been printed out for this training you can just go and explore it so this is a present recall curve for each and every uh class that you have trained for so if you go on top you can see and also you can explore the confusion matrix so if you go into this and you can just understand the the true and false positive and to negative of this particular uh performance of the model and then you can also see uh the results.png file uh where you're gonna find the uh object object uh detection information and accuracy how does how it has been able to perform on classification precision and all so you can see you can see a lot of metrics have been plotted here and you can understand the loss how the loss is going down for this particular objectiveness understanding bonding box information understanding and classification understanding so this is the information that you can understand from this particular runs folder inside this yellow visa you can also find some information like test underscore label batches what are how many number of labels you have been so you can see uh i think it's got selected yeah so you can see there are a lot of images and detections that happen for this validation test and similarly for train batch for so far each batch stores and images so we just go and explore it right so this is the information you're gonna get and it will help you to uh store the information and understand the model how it is performing and uh where we should be focusing more on right so you can go in inside this your v7 model uh folder and you can just explore this run folder inside this you're going to go in inside the strain folder and you're going to find all the weights best weights and the information regarding that folder right i think you understood what i meant to say now uh that that's a part of training and understanding that trained model now uh now here we we want to go and uh here we want to go and test out uh the train model like what was the performance although we got this performance tested so you want to if you want to get the same information uh you can use the dot test pi file so and you can mention uh data on the data dot yml file that we created right and you can mention the image same image size you have to mention whatever you have used for training and then here you can mention the confidence so according to the f1p f1 ratio even that we just that we just saw on this particular graph around the f1 curve right so it was saying that we should mention confidence around 0.36 right so we're going to mention it you can mention iou intersection of union and you can mention the device here at the cpu and then you have to mention the best weights so as i told you right the best weights are inside this particular uh train v7 model right folder so you can mention that particular path and you can give name to this particular run so now let's run this particular cell to see uh and to get uh the particular classification report on the same classification report by using uh this particular test.pi file so let's just wait for a few seconds now it will just go through all the uh test files that are available inside this test and this then it gonna give us the accuracy of that particular uh file by using our own train data our own trained trained model so you can see uh it has printed uh and it has got the accuracy uh based on the confidence level that we passed when we explore the training data set and then according to that we are able to make up a decision and we are able to test out the results on the test data set right now we want to do the inferencing so let's suppose all the training and inferencing and understanding of model has been done now we want to do an inferencing on a new data set or new of the new images right so you can use python direct dot py file which is available inside this europe v7 folder uh and you can just go over there and you can just use this by file and then you're going to mention uh the weights the best weights that you train for your current model and then you're going to mention the source so from where you're gonna uh take the uh take the image for your inference you can also mention uh the video path also here so it will start using the video to detect the uh direction of detection on that particular video so right now i'm going to do it on the images so just i'll just pass the test image folder path which is present here and now i'm going to run this and we're going to see the detection where it's going to happen and we're going to save it so it will also take few seconds to do it so let's wait for it so all the inferencing for the test folder or for the test images has been done now the detected or the inferencing images has been saved inside this particular v7 folder so again you have to go inside this yellow v7 and then you have to go inside this run and then once you run this detect.pi file right it will create a direct folder so and if you go inside this you're going to go into the experiment number two because i have ran one one experiment one uh before making this tutorial so it's showing experiment one so we can go with this uh go into this experiment number two and then you can explore the detections part the model prediction part so you can see the images and the predictions so you can see the predictions of helmet has been done uh which is performing very accurately uh although we train for just two epochs you can see it is able to you can see it is able to fail here at some point because we are just training for two efforts so it's working in that way but you can improve this particular model by training it for more epochs uh so here you for so if you want to explore the direction immediate directory images you can just go into this particular folder or text folder and there you can explore your experiment number and you can find it all your related images so this is the thing that you can create using your v7 github repository official repository and it will work fine for you all use cases and since they have been able to outperform yellow v5 current state of the art model then you can use the zero v7 on your own data set and you can prepare your uh best inference pipeline and you can get some awesome results around the objection part so i hope you enjoyed this particular tutorial if you like this particular content do subscribe my channel thank you
Info
Channel: Karndeep Singh
Views: 14,011
Rating: undefined out of 5
Keywords:
Id: rfDj1oORpeg
Channel Id: undefined
Length: 26min 4sec (1564 seconds)
Published: Sun Sep 18 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.