Train Your Custom Yolov8 Object Detection Model | step by step. #ml #ai #computervision #tech

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
had no everyone so in this tutorial I will show  you how to create a fire detection model from   scratch using yellow V8 yellow is a powerful  object detection algorithm that can quickly   and accurately detached objects and images  and in videos as well with this tutorial you   will learn how to prepare your data train  your model and test it accurately by the   end of this video you will have a fully  functional fire detection model that you   can use to enhance the Safety and Security of  your own or business follow along and discover   how easy it is to build your own custom fire  detection module using Euro version 8. foreign so in this tutorial we are going to take a look  at how you can take your own data set and train   a yellow object detection model so to begin with  you have to search for our data we'll be using   and since this is a tutorial we just head over to  cargo.com where we can get already made data so in   the browser yeah I just search for fire data set  YOLO format on cargo so we just head over to Cargo   and download the data set we'll be using okay so  here is a data set we'll be using and you can see   is from Robo flow so if you have been using your  low you can attest to it that robot flow have   been doing amazing job so you can head over to  robothrough.com to learn new stuffs for yourself   okay so just sign up for our account and download  this data set so just hit download and you'll get   it in a zip format so I've already downloaded  this so yes continue and I'll show you how to   extract this ZIP file so when you're going to  desktop this is exit file I'm having here and   write and extract it right click and just click  on extract here and you'll get new footage you   have this validation that's value trade and  data file so I'll just create a new folder   here I'll just call it data and in here  I'll just move this three Footers and one   file into it so we just move all into Data  so let's go ahead now and explore our data so if we open you can see a test we have  images so these are the image of fire Benny   at certain places that we are going to use  though the data is not that sufficient so   in your own use case you can make available  mini data so many images and they are label   so these are the icon responding label the voice  I read and when you come to test L3 it's the same   thing we have the images so this is the image  will be using to create our model and since   it's a training data it has to be sufficient or  it has to be more than that of your testing data   go ahead and also see its corresponding labels  and then we'll move back to oh our validation data   so it also contains image and labels as  well okay so the important thing here is   this data file data.yaml file so this contains  whatever we are going to trade and this must   remain like this you don't have to change it  to English our case we have train and this is   the powerful tree so we train forward slash image  the same for validation then the number of class   we are going to detect nice solidifier so it's  only one and then names we are verifiers so so in   case you have a video data set and you're having  different classes then you have to put fire let's   see then you have another like cards you just  have to click to cut and also change the number of   classes to to in this case now where are you  doing it for fire so you just have to keep   fire in this case so what I saw and I have to  close this one now okay so the next step here   is to move this your data file into your Google  Drive so that when we are using Google collab we   can get access to this data and yes train our  custom model so this is also easy to do just   open your Google Drive so you just have to drag  and drop it here and it will start uploading   so I've gone ahead and uploaded this so you can  see is the data here and it's what exactly we   are going to be using so what we can do is that  we can open this data file here and you can see   it contains the exact same thing we have in our  data file so you can see we have a bad Edition   which contains labels and images go back open  screen which also contains which is the exact   thing I've just uploaded into my Google Drive and  you have to do so if you want to use Google Now   to train your model and the reason will be using  Google connect is that will get free access to GPU   which was a read our model train so now that we  have our data in Google Drive we just go ahead now   and open Google cool app so this  type will Google up then we hit enter wide and open a new notebook so I have to go  ahead and change this account to my account so this is my account and then what I have to do here is to create a new  node we'll be using for this particular tutorial   okay so here is the new notes we'll be using for  this tutorial and what you have to go ahead and   do now is to mount our drag so I'll open here  and you will see the drive symbol here so yes   click on it I need to tell you Martin your  drive you have to confirm and it will Mount   Your Google Drive so that you have access  to the data we have in our Google Drive okay so one of the drive is mounted you can  see we always try fire so we can go to drive   go to my drive and then now you have access to   our stops here so we're gonna see we have our  data and in here we have test string validation   the data.tml file so we can close this app  now and go ahead and write some code so the   first thing we'll do is to check our run time  so we can just go to run time here and we got   change runtime and we'll set it to this none by  default so we set it to GPU and then click save   so now we are getting access to GPU  free GPU in this case which we'll use   so we can conserve that by attacking  Nvidia it's going to show up at all   Nvidia s and I and click enter  so we'll run the cell to check what happened so run this out to check whether  we are we access the GPU and you can see yes   so reality access to GPU here so we  can now go ahead and clear this one off   we can add a new cell and the next step is to  install you so you will just have to type install ities so you click enter so you can run this cell now and   you will be installed so it will take  some time depending on your data speed so actually training your own model is very  easy to invest better you just need about   three lines of code to do that so you  have successfully been installed We'll   add another code learn and what it will  do now is to import it so we'll see from alternatives we are going to import your back or cut you look just like this okay so do  something else to write it can run D cell to   check our yulu is properly installed and you can  see we have to check them out for all the lines   with ram so far that means we are doing good so  the last line here is the line we need to train   we need to use to train our model so to train  your model we have to just write exclamation   mark to Euro and Lower Keys so you write to YOLO  then the tax you are going to perform so the top   you are going to perform is a dictation please  just write the tit an volt you are going to   use so our mode here is to trade after the mode  you need to choose your model so the model type   we represent model types or model type we want to  use now is the Nando version so we have the large   the medium and the Nano version so who is the  Nano version because we need speed what we we   are using our model so we just have to write new  Loop V8 because we are using Yellow Version it   and for Nando you just type n is what you use the  knights module yes write scale here which stands   for Knight so we are using Nando dot 80 then  the next thing is to give the directory to where   your data is so for that the simple thing you  have to do is to come here then open my drive   then you open my data and then you copy right  click here and copy the path yes come here and   place this button so you can see our data is in  content drive my drive data and then data dot EML   fine okay after this you have to give ebooks  like how many iterations so this data trade   so you specify it works and you give a value so  you can give a higher value and this data will   train over and over and over and over but I also  have early stopping so in case it's training and   it sees no improvement in your data for some  number of times it automatically stop trading   so in this case let's specify in 30 because I've  already trained DC model that will use so I'm just   showing you how to train some yes enter something  like let's do a system to try to train any and you   can see for yourself then after that we have to  specify the image size so imgz you start foreignty in this case so with this right click 640 and  guess what we are done so this is all you need   to trim your fat so after this we'll run this if  we have error that's it if we don't it will kick   off and starts training so we are having some  arrows here and let me check the lines oh okay   so we need to specify here that this is our data  so we have to write our data is equal to this so   that is our data we need to specify that this is  a directory for our data and let's run this again   and I hope this time I run it through trade  we've got error wise again let me scroll shape   images this will be images and not image images  wow so guys we keep on getting this error because   we don't have equal to sign here tax is equal  to the debt mode is this so let's give it a try   I've made a lot of mistake writing this app so  let's try it this time around and you can see   era started training so it's downloading  some Styles I need to train so let's see   what you'll get you so is now reading our images  in in the tree and file so it's loading all   the image is there so this will take a while to  train so guys I'll ride back after the training   so guys I'm back and this is still training so  it has just started training now it took a lot   of time loading in the images it's not raining  and without the first epoch so we still have   to give this some time it's what I'm going on a  second break and I'll be back right after this okay guys so as you can see we have done  training so everything is successful so   the good thing is that it also show you where  your results are saved so it's a result as if   to rise detailed screen directory so you  guys have to click on the file icon here   and we can locate our run where did I see so you guys see we have the round folder here   and then you'll be your detailed folder up you  open your train there's that and you're gonna   see so what we need here is our width and  this weight will be stored in the weights   folder so we have the last and the best so  this is the best performing weight and all   you have to do here is to download it so you  click on download and it will get downloaded   but before that we can also have a look at some  training this guy here so we have the F1 cave so you can see this is how it looks you can also  this is not showing I don't know how to drag it   but just know that we have other case you can see  the confusion Matrix which is very important you   can also take a look at it it's not showing well  in collab I don't know why or you can download   this and also take a look at it so you can click  download and download it and look at it how well   your model is streamed so all we need here is the  wait fire I just went ahead and downloaded it so   with these simple steps we are able to train  our custom model and we are now going to run   inference on it and check whether it's going to  detect fire so we are now done with Google Cola   we've downloaded our weights so all we have to  do now is to open our pajam and write some code   so actually I said write some code but we are not  going to write code because you already have the   code for this remember we had a video on how to  run your EO ID you'll do this to be specific so   we are just going to leverage that same code and  change the weight file in our video then we can   just change the class so I've already prepared  a script for that which I'll open press it it's   on desktop here so fire detection and here is  it so what I'll do is create a new file here   so new python file and I'll just name this file  and I'll copy the same code and paste it there so   I'll paste this same code here and get rid of that  file so this your code will be using and there is   nothing new apart from the width so our width here  is fire.pt when you download it is best.pt so we   can also go to our download files so let's see  downloads and you can see this is the best DOT   PT file we've downloaded from Google connect so  I just change the name I rename it just brought   it in into python so instead of loading the  normal yellow model we are going to load fire.pt   and also I have a video file here called  fire through.mp4 which we are going to run   the inference on and this code is pretty much  the same code we've used in how to run YOLO in   the IDE so the link to that video will be in the  description and it will also be somewhere at the   top here so you can take a look at it so that  you understand this code better and also the   whole code will be on my GitHub repository where  you can visit them download it and use it for   yourself okay so that's pretty much it and also  what you have to do here is that in that tutorial   we have classes.txt which contains many classes  but in this case you just have to delete all   everything there and just do classes is equal to  file because it's only file that we want to detect   so that was the changes we've made so far and now  we can go ahead and test this out and see how best   it to detect fire so I'll run this around this  and we can see let's see okay so this is cool it's   detecting fire already and that's it the detection  is just good I have another video file we'll try   this on to check how well it will perform  this tool but I think is correctly detecting   that is fire wow so this is nice this  is performing good with our 57 that   Precision champion from here and there  and if you want a much higher accuracy   then you need a lot of data you need to train  this on a huge normal images containing file so that's the video let's run it on a second  video file which is fire 2. okay that's this   far too so let's do fire four so but the next  video is five four so let's run it on fire four wow so you can see how well is the 13 on fire four so I think the model is working great a  detecting fire okay it's getting some detections   so I think this can be improved  right it gets training it on more   data or a huge number of images containing fire so guys this is how easy it is to create your  own object detection model using YOLO and you   can see this is very easy so all credit is  to ultralight this for making this possible   by using few lines of code and this is the  main reason why I love the Yellow Version   is because it's very easy to use very  easy to train on your custom data set   and you you can attach that by yourself you  just have to go through few steps to achieve   this so if you like this video guys do your  best to subscribe give me a like write your   comments I'll be more than glad to reply you guys  so thanks for watching and I know you are probably   gonna share this with two or more people thank you  once again and I will see you in the next tutorial
Info
Channel: Tech Watt
Views: 9,605
Rating: undefined out of 5
Keywords:
Id: FBavXyN18K8
Channel Id: undefined
Length: 21min 6sec (1266 seconds)
Published: Wed Mar 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.