window 11 yolov5 custom object detection | yolov5 custom object detection | labelimg tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends and welcome to YouTube channel Freedom Tech and in this session what we are going to learn in this session we are going to create our own custom model for YOLO V5 on Windows 11 okay but before we move to a practical friends if we learn something from our videos please consider to subscribe our Channel okay friends thank you so much and let's get started so friends for that first we need here we are going to do all these things step by step okay so we need here Tony python ID so tony.org this is what their official website then go to the window click on here it will download our setup.exe file okay so I have already download setup.exe file and also I have already installed Tony on our windows 11. so as we always install any normal software on our Windows simply click on next next and it will install Tony python ID on our Windows machine then we need here opencv and yellowfi so go here and just click on Tony it will open our Tony python ID then go to the tools manage packages and opencv opencv hyphen python just hit enter I already installed opencv and YOLO V5 okay so you need to search here open Simi hyphen python it will search for opencv hyphen python click on here and then just click on install it will install opencv okay then we need here YOLO V5 so YOLO V5 and just hit enter it will search for yellow if I so here it is whatever YOLO if I click on install button and it will install YOLO WiFi on our windows 11. so we have done with package installation now we are going to capture our images for training so we are going to capture our images with the help of our USB web camera basically we are going to create the model which basically detect Arduino board and Raspberry Pi Pico board so I have created here a repository the repository which basically we are going to use for capturing image also we have here our Google collab file for training purpose okay so IMG dot pi and this is what our Google collab file so I will mention the link inside description box copy and paste link inside the browser then go to the code we are going to download zip format folder okay so as you can see it's downloading our file so go here show in folder then this is what our folder in zip format right click extra call click on extract this is what our folder double click and IMG this is the python file which we are going to use for capturing our images okay so we are going to open this file inside our Sony so just close all these things minimize the browser and again we are going to open our Sony python ID so go file open and we have our folder inside downloads and this is what our folder okay again same folder and IMG this is what our python file so as you can see this is what our python file as I mentioned with the help of this file we are going to capture our data images or we can say our object images so 30 30 is basically Max frames it means right now I am going to capture 30 images for each object for Arduino and for Raspberry Pi Pico board okay 30 images if you want to change the number if you want to increase the frames simply change 30 with 70 if you want to go 100 simply mention here 100 okay it will capture 100 images of each object so right now we are going to capture here 30 images for each object so just save it now here cv2.mright here we need to mention the path here okay from from images okay so this is what the path so right now we are going to save our images inside download folder our same repository folder YOLO if I win 11 custom obj hyphen men this is whatever folder this is the folder this is zip folder and this is whatever uh main folder okay so inside that we have again a folder same so here we are going to create our images folder and inside that images folder we are going to save our all data so right click and then new folder and images that's it images folder so just click here and this is what the path okay so right click copy and we are going to paste the path here we need to paste the path here just images okay so from images we are going to remove all these things and we are going to paste our new folder path control plus me okay and now what we are going to we are going to change this slash this backward slash with forward slash just change the backward slash with forward slash and this one also okay and then our folder is basically inside this folder this is what our folder and inside this folder yellow V5 win 11 custom obj hyphen main this is what our folder and inside that we create images folder so here we need to mention our images folder ok so this is the way you need to mention the folder path where you want to save our all images okay so now what we are going to do I already mentioned here Arduino so this is what our first object the object images okay so we need to mention here your object name so right now we are going to capture Arduino board image so simply I have mentioned here I don't know then after we are going to mention here R5 Pico so let's just capture 30 images of our Arduino board so now I am going to save the code and I am going to run the code and then I am going to show Arduino board in front of our USB web camera and we are going to Simply move our Arduino board slowly slowly to front of camera and it will capture 30 images of our Arduino board okay so let's just start code as you can see this is what our Arduino Uno board and I am moving Arduino Uno in front of camera slowly slowly in different different angle it will capture images of our Arduino board so we have successfully captured 30 images so let's just cross check inside downloads we have here yellow V5 win 11 custom OBG hyphen main this is what our folder so just click again same folder and inside that we have images folder and as you can see inside folder images folder we capture all our 30 images so if I open like this way this is what our board images okay so same way now we are going to capture RPI picot board images so here we want to Simply change the Arduino with RPI because so just remove Arduino and R pi hyphen Pico RPI let's P Capital make okay R Pi Pico so just save it and again we are going to run our code and this time we are going to show our R5 keyboard to our web camera so save the code and run the code and as you can see this is what our RPI Pico same way we need to move our board in front of the camera in different different angle slowly okay so we have captured our all two object images so if I again open download folder images so now we have our RPI Pico images also as you can see R5 Pico ok so we have done with our data capturing process we have our data ready now what we want to do we need here label EMG software okay so friends one more thing I just want to mention here label EMG is not work with python 3.10 because I have already tried it's not work there is a error so we need here python 3.9 so before we install label EMG we need to install python 3.9 on our Windows machine so just open Microsoft store here we are going to search for python and then python 3.9 click on python 3.9 and just install python 3.9 on Windows machine I already installed python 3.9 simple now we are going to open again our Sony python ID and here what we want to do we want to change The Interpreter so right now we are in Python 3.10 okay so let me show you I am going to close all these things and again if I open Tony and as you can see by default it's worked with python 3.10 but we want here our label EMG software so we installed python 3.9 so we need here python 3.9 inside our Tony so for that we need to go here run configure interpreter as you can see configure interpreter inside the Run we have First Option select it and here we are going to select our python 3.9 this one as you can see python 3.9 select it click on OK and now we have python 3.9 inside our Tony okay so this is the way you need to change the environment simple now go to the tools and open system Shield so now here we are going to install pi cutify and our label EMG so run the command pip install pi qt5 and just hit enter it will install pack notify I have already installed requirement is already satisfied then peep space install label label EMG pip install label EMG it will install label AMG so I already installed both packages okay so requirement is already satisfied so this is how you need to install pi cutify and the label EMG now we have our label EMG simply we need to run the command label EMG label IMG as you can see label IMG not EMG basically label IMG so just hit enter as you can see we have successfully installed level IMG and now we have our label IMG now go to the open dir and we are going to select our Dr where we have over all images so downloads then YOLO V5 win 11 custom folder OBG hyphen Main same folder images folder select folder now we have our images again we are going to change the saved IR same dir okay downloads folder again same folder images folder select folder that's it now here we need to select yellow create rectangle box and we are going to simply draw a rectangle on our Arduino board and here we need to mention Arduino this is what our class name Rd no Okay click on OK simple same way just save the image next image create rectangle box again we are going to draw a rectangle here same level same image just click on OK save it next image rectangle box draw it on our board click on OK so this is how we need to draw a rectangle box on our object so now I am going to draw a rectangle on our Arduino board then we are going to draw a rectangle on our R Pi picot okay so friends we are done with Arduino board now we have our picot board so again create rectangle box and we are going to draw a rectangle on our RPI picot and we are going to mention here R Pi hyphen Pico okay R Pi hyphen Pico our next class click on OK save the image next image create rectangle box and just draw the rectangle box on our R5 picot RP code click on OK save it okay the next image create rectangle box and just draw a rectangle box right here okay so now same way I am going to draw a rectangle box on our Pico board okay friends so friends we have successfully draw a rectangle on our last image which is our R5 Pico so we have done now simply close the label EMG software close the shell and here we need to change the python version okay again so go run configure interpreter then here we need to select first one which is by default python 3.10 select it click on OK and it will automatic change our python version so now we are in Python 3.10 version simple now what we are going to do we are going to create a folder so again we need to go inside downloads this is what our repository which we clone or which we basically download as a zip format file so yellow V5 win 11 custom obj hyphen main this is what our folder again same folder and we have our images folder and inside that as you can see we have our files and images okay so now what we are going to do we are going to create a data folders so for that what we want to do we want to go back okay a yellow V5 win 11 custom OBG hyphen main where we have our images folder so here we are going to create a new folder so right click new folder and mention same name as I mentioned data data folder again click on data folder now we are inside the data folder now here we need to create images and labels folders so right click create images folder and second one is our labels folder so labels so we create a two folder images and labels inside data folder now again go inside images folder and here we are going to create training and validation folder so training so right click new folder training and next one is our validation okay so we create data folder inside that we create images folder and inside images we create validation and training folder now again go to the data folder then labels and here also we are going to create training and validation folder so just right click new training folder and validation folder validation okay so data folder we create two folder labels and images and again inside images we create validation and training folder okay and same way we create inside labels we create validation and training folder now what we are going to do go here yellow V5 win our main folder and we have your images folder just copy all the data so press Ctrl a and just copy it copy and we are going to paste all these things inside data images validation just paste paste it okay then same way in training just paste all the things now again go to the data inside labels validation paste all the things again go back labels inside training paste all the thing so this is how you need to copy and paste all the data from images to our data folder to images training copy and paste then validation just paste same way inside labels same way inside labels we have training and validation just paste the data here also just paste that's it so we have successfully copy and paste all the data inside our data labels images and training validation folder both folders simple now what we are going to do we need to create the zip file okay so just come here our main folder and this is whatever data folder so we need to create a data.zip file so right click because I have already installed here WinRAR so just add to Archive click on zip data.zip just click on OK it will create our data.zip file as you can see this is whatever zip file now we need to move this ZIP file on our Google Ram so friends I have opened my Google Drive so right click and click on file upload and then we are going to go inside downloads our yellow u5 folder then we have here our data.zip file so just select click on open it will upload our data.zip file on our Google Drive so now open Google collab as you can see this is whatever Google call app go to the file click on upload notebook choose file and we have our folder which is yellow V5 win 11 custom obj selected again same folder and this is whatever as I mentioned this is whatever Google collab file so just select click on open it will upload our file on our Google collab so as you can see it's uploading so friends we have successfully upload our file so go run some type change runtime type select here GPU save and click on connect so friends as you can see connected we successfully connect now we are going to run our code step by step so this is what our first code just click here it will install yellow V5 on our Google collab then just scroll down now we are going to connect with our Google Drive so run our second code so permit this notebook to access your Google drive file so click on connect to Google Drive select your Gmail ID scroll down click on allow now it will Mount our Google Drive on our Google collab so friends we have done and as you can see this is what our data.zip now we need to unzip our data dot zip so just run our next code it will unzip our data and as you can see we have our images RPI Pico and their text file we have our Arduino image and Arduino image also we have Arduino text file now what we are going to do we need to click here which is the folder icon and then yellow if I train then yellow V5 and here we have data set yaml file so just double click and it will open our data set yml like this one here we need to measure our own class so our first class is basically Arduino which I have already mentioned but our second class is R Pi Pico so just remove this esp32 and we are going to mention here RPI Pico in single quote R Pi hyphen hyphen capital p and Co Pico Arduino RPI Pico this is whatever two classes this or we can say this is whatever two object and here the number of classes same because we have here two number of classes if you have four you need to mention here four and your four classes name and names you need to mention this way first second third and fourth okay so right now we have only two classes so two and I have mentioned two names of our classes Arduino board and R Pi Pico okay now simply click here and press Ctrl plus s it will save our data set y a ml file simple so just close and now we are going to run our last code just scroll down and this is what our last code it will create our model so click on here so friends as you can see our training is started 0 by 99 so it will take some time as soon as our training completed I will start video again so friends our training is completed and as you can see this is what our classes Arduino and RPI Pico and our model is save inside run strain exp so just scroll up and go YOLO if I train just click here you'll notify then the runs folder as you can see the runs folder so runs and inside that we have train folder exp folder weights and base dot PT this is whatever custom weight filebase dot PT so just click here and just download okay so it's now downloading our base dot PT so friends as you can see we have download our model base dot PT okay so just click here show in folder this is whatever model so just minimize and what we are going to do we are going to close all this thing our Google collab our Google Drive and all these things and now again open our file manager this is what our model so now what we are going to do we are going to move this model inside our repository our folder so right click cut downloads YOLO V5 win 11 custom OBG hyphen main this is whatever folder same folder again and here we are going to paste our model so just paste because we are going to create our python file in same folder okay so now close all these things open again Tony and we are going to create our new file click on new we need to mention the file so just click on Save and we are going to save our file as I mentioned in same folder so downloads yellow v511 custom OBG hyphen main again same folder and here we are going to create our new python file so test dot py simple name click on Save okay so first we are going to import CV2 then we are going to import torque then we need to mention our custom model path where we save our base dot PT so go to the file manager and downloads our main folder yellow if I have been 11 custom OBG hyphen main again same folder and here we have our base dot PT we save our model inside YOLO V5 win 11 custom obj hyphen menu this is what our repository so just click here it will show the path copied path close the manager file manager and we are going to mention our path like this web path is equal to in single code just press Ctrl V and again we are going to change this backward slash with forward slash forward here also same way and then at the end we need to mention our model name best DOT PT simple now after that we need to mention our model so our model by default model path as you can see this is Whatever by default model path from pytalk.org this is their website okay so just copy this model path and open Tony and just paste and here what we are going to do because we are going to use here our own custom model so we need to delete this YOLO if i s okay so just delete and here we are going to mention custom because we are going to use here our own custom model so custom simple and then we need to mention the path variable because the path variable is our model path so simply here we are going to mention path and then we need to delete pretrain is equal to true and we are going to mention Force iPhone reload is equal to true so Force hyphen reload is equal to true so then while loop and then first we need to mention here our camera okay so we are going to mention here our camera so cap cap is equal to CV2 dot video capture as we always do video capture and inside that we need to mention our index number so I have here only one camera so zero web camera USB web camera okay then red frame is equal to cap dot read okay so this is what our basic code which basically start our web camera okay so if I save and if I run and friends as you can see it started our camera so now we need to call our model then it will detect our object so our model so after where we resize our frame here we are going to mention results results is equal to our model and inside that we need to pass our frame also we need to call our numpy so import numpy as NP okay and then here where we call our model results is equal to model and inside that we mention our frame here we need to mention frame variable and then we are going to use NP dot squeeze function so NP Dot squeeze okay NP dot squeeze and then inside that we need to pass results dot render results Dot render like this one simple so if I save the code and if I run the code so friends as you can see it started our frame but uh let me make a frame C2 dot okay I forgot to mention here frame variable that's why it the frame is by default frame okay it's not changed the width and height so I forget to mention your frame variable now it will it will select our width and height which we mentioned now that's good okay so here if I show Arduino board and as you can see it's detected our Arduino board okay let me make like this one is detected our Arduino board now if I show Pico board and as you can see it's detected our RPI Pico also so we successfully create our own custom model which basically detect our custom objects so here we have Arduino board and here we have our RPI Pico okay so I hope you will learn something from this video we will meet our next video till then thank you check Karen bye
Info
Channel: FREEDOM TECH
Views: 10,656
Rating: undefined out of 5
Keywords:
Id: Ql4N9tdtB3U
Channel Id: undefined
Length: 28min 58sec (1738 seconds)
Published: Thu Dec 01 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.