raspberry pi 4 yolov5 custom object detection | How to Train YOLO v5 on a Custom Dataset | yolov5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends and welcome to YouTube channel Freedom Tech and friends we successfully detect objects with the help of Google WiFi on our raspberry OS Bullseye 64-bit version so in today's session we are going to detect custom objects with the help of neurologifi on Raspberry OS Bullseye 64-bit version okay so but 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 if you don't know how to install YOLO V5 on Raspberry OS boots a 64-bit version I will mention video link watch video and install yellow V5 on Raspberry OS Bullseye okay so for today's session for custom object detection I have created here a repository okay RPI yellow V5 I will mention link of the repository inside the description box you need to Simply copy and paste the link inside the browser that's it then go to the code and we are going to copy the link okay like this way copied link and open Terminal and we are going to Simply clone our repository okay so run the command so do good clone and paste the link of our repository and just hit enter it will clone our repository that's it now we need to change the owner okay so run the command sudo CH own space hyphen capital r okay like this way hyphen capital r sudo space CO2 space iPhone capital r Pi is the user then colon buys the group and our repository name which is the R5 your load E5 that's it so we successfully change the owner for our repository now we need to Simply open our repository so I am going to open file manager this is whatever repository okay and inside that I have created the image dot Pi then this is what our txt file and this is what the Google Cola file for training purpose okay so first we need to install some packages basically we are going to install label EMG on our raspberry OS for image training purpose okay so this is what the text file simply right click Text Editor and it will open the file inside our text editor that's it so this is what the first package okay so just copy the first package open Terminal and let me clear screen and just paste the command which we copy it from our text file just hit enter it will install Pi q25 on our Aspen Osage which I already installed that's it then our main software which is label EMG so again just copy the command from our text file open Terminal and just paste and hit enter it will install level EMG on our raspberry OS Bullseye 64-bit version I have already installed okay so that's why it says as you can see the requirement is already satisfied okay so this is how you need to install label EMG on both side so now we have our software now we need the images the object images okay for that I have created a python file image dot pack this is the python script for capturing our object images with the help of our USB web camera so I have connected the USB camera with our Raspberry Pi 4 okay so simply what we are going to do we are going to open our Sony python ID and we are going to open our IMG dot pi open then RPI YOLO V5 this is whatever folder and IMG dot Pi click on OK that's it and find me full screen so this is what our script okay uh it will basically capture 70 images okay for each object okay so max frames is basically 70 okay so it will basically capture 70 images of each object so we are going to Trail here basically two objects okay the first one is our Arduino board and another one is basically our Raspberry Pi Pico you can train more images okay so for today's session we are going to only Trend the two images our two object which is the Arduino board and Raspberry Pi Pico board that's it so then where we are going to save our all images so we are going to save our all images inside slash home slash Pi images folder okay so you do not embrite this is what the path where we are going to save our images okay so we need to create the folder inside Slash from slash Pi images folder okay so right click new folder and images is the name of our folder simple so images and right now it's empty because we are going to basically capture our images okay still there is no data okay simple and these images is basically our object name means here we are going to start with Arduino board so Arduino is our first object name so we need to mention that object name and it will capture object first object 70 images means it will capture Arduino board 70 images and it will save all images inside slash and slash file images folder okay so let's just save the code and we are going to Simply run our code okay then we are going to Simply show our Arduino board to our USB camera we need to slowly move our Arduino board in front of our USB web camera then it will capture a different angle Arduino board images with the help of our code and it will save all Arduino board images inside slash on slash by images folder okay so let's just start our code okay so friends we have successfully capture our Arduino Uno board images so simply if I open file manager and images as you can see this is what our 70 images for our Arduino board so if I go here image viewer as you can see 70 images we have here 70 images that's it so same way we are going to capture our picot board image okay so now here we need to change the name of our object so now R pi R pi picot okay now it will capture Raspberry Pi Pico board 70 images inside Slash from slash by images folder okay so save the code and run the code okay friends we have successfully capture our RPI Pico board images so if I again open file manager and images folder this is whatever Arduino images and as you can see R5 because if I go here image viewer this is what our Raspberry Pi Pico okay this is Arduino this is what our Raspberry Pi Pico as you can see so we have successfully captured our object images now we need to Simply use our label EMG software and we are going to draw the rectangle on our object so open Terminal and run the command without sudo okay l a b and just press tab button it will auto complete our Command okay l a b press Tab and it will auto complete our Command then just hit enter it will open our label EMG software like this way click on open dir select the Dr where we have our images so we have our images inside slash home slash Pi images folder simply click choose then change saved there and the save dir is also same slash Pi images click on choose that's it so now here we need to select YOLO okay as you can see the yellow and then we are going to Simply create a rectangle box so click on rectangle box and then we are going to draw the a rectangle box on our object and here we need to mention our object name which is Arduino okay that's it click on OK click on Save click on next image again click on create rectangle box and just create the rectangle box and name is also same Arduino just click on OK so let me draw the rectangle on our all Arduino images okay so friends we have successfully trained our Arduino images now we have our Pico images Raspberry Pi Pico board images okay so again create rectangle and we are going to Simply create rectangle on our object which is our Raspberry Pi Pico board Okay so RPI R Pi okay hyphen Pico okay let's say R by Pico okay R5 hyphen because this is whatever name save it next create rectangle box we are going to create the rectangle and R Pi happen because okay same way again save next image create rectangle box then draw the rectangle click on OK so now I am going to simply draw rectangle on our our pipe picot board okay so friends we have successfully drawed a rectangle on our object which is Arduino and Pico okay now we have done now simply we are going to close our label EMG software so what is next we need to open file manager and here we are going to create again new folder and the data is our folder name okay mention same name friends so data okay and let's just open our data folder and here we are going to create two folder images and another folder name is labels so let's just create two folder inside slash Pi data so again new folder images okay and then another one is labels labels so we create a two folder inside slash home slash pipe data okay images and labels now inside images again we need to create a two new folder first one is training and second one is validation okay so let's just create new folder training then second one is validation validation that's it training and validation same folder which we want to create inside our labels folder okay same folder so again new folder training then second one is label us sorry not labels validation okay validation okay so training and validation inside labels and same folder which we create inside images folder okay so now what we are going to do we need to Simply copy and paste our data inside our images training validation folder and labels training validation folder so let's just press Ctrl a it will copy all the data right click copy and back data folder images training paste over here all data back validation test data then back then back then labels training paste then labels validation paste that's it we have successfully put our data inside data images training okay then images validation data then labels training data okay same data and labels validation data that's it now what we are going to do we need to create a zip folder so our Command I mentioned the command inside our text file so our repository is basically RPI yellow V5 this is what our text file and this is the command for zipping over folder just copy it from here open Terminal and just paste the command and hit enter as you can see it's creating our data as a zip folder okay then we need to save our folder on our Google Drive means we need to upload our data.zip folder on our Google Drive okay so simply open your Google drive as you can see I have opened my Google room right click okay file upload and then go to the pi and we need to search for our data.zip as you can see data.zip click on open and it will now uploading our data.zip means it will upload our data zip folder on our Google Drive simple so meanwhile what we are going to do we are going to upload our collab file inside our Google collab okay so friends as you can see I have opened Google collab here we are going to click on upload choose file and then we are going to Simply open our arpa yellow V5 repository which we clone okay and inside that I have share our collab file so just click on open as you can see this is what our file ipy and B extension YOLO V5 custom obj selected open now it's uploading our file inside our Google collab okay so friends we have successfully upload a file now go to the runtime click on change runtime type and here we are going to select GPU click on Save and then click on connect okay now it's connecting so friends we have successfully connected our file now simply we are going to run our first code so just click on here now it will run our first code it will create yellow WiFi Trend folder and inside that it will create YOLO V5 folder Okay so we have successfully run our first code so if I click here on the folder okay and as you can see yellow V5 Trend folder and inside that we have Lola V5 folder and inside yellow V5 we have all the files and folders okay so second code so just scroll down so second code is for basically mounting our Google Drive data okay so let's just run our code second code connect to Google Drive we need to give the permission so connect to Google Drive now select your account select it then just scroll down click on allow now as you can see it started our code it will Mount our Google Drive okay on my drive folder and as you can see it's mounted our drive and we have our data dot zip folder simple so simply click on third code and it will unzip our data.zip okay so we have successfully unzip now if I go here I need to click on yellow if I trade and then as you can see we have our data folder inside that we have images the labels folder and training and validation and inside trading and validation we have all our data that's it so now what we are going to do we need to Simply go here yellow V5 folder open yellow WiFi just select it okay you'll notify and then scroll down and we need to make some changes inside data set yaml so data set yaml file is basically inside our YOLO V5 folder okay so as you can see data set yml click on double and it will open code like this way okay so let me make like this one so this is what our bad default code and here it is as you can see number of classes so right now we are only training two classes suppose if you have 10 classes you need to mention 10 because you are going to train 10 classes so right now I am going to train here two classes so I am going to mention only two then here we want to mention your classes name so we have already know already there so next one is our second one is basically our R pi Pico this is what our second class if you have more than two classes so you need to mention their list as names okay so I have here only two classes so I have mentioned Arduino RPI Pico and number of classes is also true so simply just click here like this way and press Ctrl s that's it it will save our code that's it we are ready and now we are going to Simply run our last code which is this one it will create our model okay it will create our custom model so let's just click on here as you can see it started the process as you can see it's basically scan all the data now as you can see the process is started okay 0 by 99 okay so it will take some time meanwhile I will pause video okay so friends as you can see it's completed process and results save inside run strain exp folder okay so we need to go here again let's just click on here okay double click and then yellow if I Trend this is auto your main folder yellow before train okay click on here yellow before train then go to the yellow V5 folder then we need to go runs as you can see runs train and exp so click on the runs folder train folder exp folder and inside that we have weights folders so just click on weights and then this is what our model best DOT PT so we need to download the model okay so simply click on here and click on download okay so now as you can see it's downloading our model as you can see it's download our model okay so let's just minimize the browser open file manager and downloads and as you can see best DOT PD this is what our model our custom model so just copy the model because we need to more module inside our YOLO V5 folder okay so we need to go here go here home and then we need to basically go file system root okay file system root and then USR then local then we need to go live python 3.9 these packages and here we are going to search for yellow WiFi so just scroll down scroll down scroll down scroll down and here we need to save our own custom model this is what by default model for yellow V5 as you can see yellow V5 as dot PT this is the by default model and same here we need to paste our custom model which is best DOT PT now what we want to do we want to make some changes inside the detect dot Pi we need to basically mention our own custom model path so this is what our custom model path slash user slash local lift python 3.9 this packages YOLO if I hear V save our module so we need to mention our model path inside the detect dot part so simply open Sony python ID and this is whatever old IMG dot Pi file so just close all these things go to the file click on open and then go to the other locations computer search for USR then local the nib then python 3.9 these packages and here we are going to search for YOLO V5 folder and then our detox.pi click on OK that's it it will open our detect.pi okay just scroll down and here it is as you can see this is what by default path okay this is what by default path for YOLO V5 s dot PT as I mentioned this is the by default model for object detection yellow V5 PT okay as you can see yellow V5 is pretty so here we need to mention our own module so again we need to create same variable which is wax as you can see I have created the weights variable is equal to this is what our path for our custom model as you can see as I mentioned this is the path slash user local python 3.9 these packages you'll notify just copy it and just paste with single code as you can see Slash user locally python 0.9 these packages yellow V5 and this is whatever model name best DOT PT so we are going to use our own custom model so simply we are going to commit the by default model so let's just come into shift and hash that's it save the code now we are ready and we are going to run our command with the help of our terminal okay so here what I am going to do I am going to run the command so command is like this way sudo space yellow V5 detect and because we are going to use our USB camera so we are going to mention source so detect hyphen hyphen source hyphen iPhone source and our camera index number so I have only one USB camera so I'm going to mention 0 as our index camera now what I am going to do I am going to start my mobile camera and I am going to show you a live object detection with the help of our own custom model okay so I am going to start code and then I am going to record all these things with the help of my mobile camera okay friends and as you can see it's detected our Arduino board okay as you can see as you can see friends is detecting Arduino board now we are going to show the picot our Raspberry Pi Pico board and as you can see it's detected our picot board also okay this is what our Arduino board and this is what our Pico okay so we have successfully detect our custom objects now simply click on Terminal press Ctrl C and it will close our frame okay so this is our friends you can create our own custom model with the help of uh Google collab and you can simply train the object image x with the help of label EMG software on Raspberry OS boot size six to four bit version I hope you will learn something from this video we'll meet our next video till then thank you chakkaran bye
Info
Channel: FREEDOM TECH
Views: 14,137
Rating: undefined out of 5
Keywords:
Id: fBHvyiXE0RY
Channel Id: undefined
Length: 26min 19sec (1579 seconds)
Published: Thu Oct 06 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.