Label Images for Object Detection | Annotate Images for Machine Learning | YOLOv4

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
do you know that in order to build and train any object detection model or classification model be it using a standalone convolutional neural network or using yolo v4 framework you need to have image data set that is labeled or annotated so how can you label your own image data set free of cost [Music] folks nitin here and this is the ai university channel in this video i am going to tell you how to label your own image data set so that we can build our custom object detection model according to the data we have for example you may want to build an object detection model to detect home appliances somebody wants to build an object detection model to detect various vehicles such as cars trucks bikes etc so people might have different use cases i'm going to tell you how to convert them into yellow format so that these can be easily read during model training so watch this video till the end if you are new here then consider subscribing to this channel a lot of times i see people appreciating the content but forgetting to subscribe due to immense excitement please show your love and support by liking sharing and subscribing to this video as i will feel highly motivated if you have already subscribed then click on the bell icon to receive the notifications about hottest technologies of 21st century you can download the code related jupyter notebooks and other related material by enrolling to this course on the ai university website if you like to go through these courses on mobile then consider downloading the ai university android app all the courses are offered free on our website so you have your own image or video data set and wants to build your own object detection model image labeling or annotation is one and same thing and it means drawing bounding boxes around different objects in the given image bounding box labeling technique is one of the many annotation techniques and once we draw the bounding box we then go ahead and label that object to identify if it is a person laptop bike or even a pet like dog or cat here we will be using a tool called as label img which is very simple to use and is free or open source and which allows us to create bounding boxes using this tool you can save your own image directly in yellow format one of the good thing is that we don't need to resize any image in the data set and we can annotate images of any size yolo takes care of image size during training so now let's see how to install this label img tool i am using windows computer and anaconda distribution of python so i am going to show you the steps with respect to it only but if in case you have mac os or ubuntu installed on your system then you can just drop a message in the comment box and i will be glad to share the steps for those as well so here is the link to install the label img tool now let me scroll down a bit okay so they have given certain introduction and some documentation of this particular tool here okay and as you can see the installation steps are mentioned here and they've listed the steps for ubuntu mac os windows right this is these are the mac os uh set of commands then windows then windows plus anaconda and even docker so i'm going to show you the steps with respect to windows plus anaconda only so let me first open the anaconda prompt so here you need to first activate your virtual environment and the command to activate your own virtual environment is activate and then the name of the virtual environment i have already created one virtual environment with the name application e and these hence i am activating that environment only so press enter so you can see that my virtual environment is activated now now run this command we need to install uh pi qt so conda install phi qt equals to 5. and then press enter so in my case uh this particular package is already installed hence i'm seeing this message all requested package packages already installed now we need to install one more package which is lxml so you need to type conda install hyphen c anaconda and then l x m l and then press oh wait a minute there is a typo so it should be conda install iphone seek anaconda lxml and then press enter so apparently uh this particular package is already installed on my computer as well so now let's go to uh github page for label img and then download the label img tool from there so as let's scroll up and you would be able to see this particular button which is code so just click on it and you will see a few options here so just click on download zip and the download will start at the lower left corner once downloaded we need to unzip this folder and keep that folder in our c drives user location so you could see that i have first uh unzipped this folder label img master and then kept that folder or moved that folder into my c drive's location user location right and these are some of the files inside this particular folder now let's go to the anaconda prompt and change the current directory to this particular directory which is label img hyphen master okay so okay so so in order to go inside this particular folder you need to type cd and then the name of the folder which is label img hyphen master okay when you type dir here you would be able to see the same files so dir is the windows command to see all the files which is equivalent to ls command in linux so now run this command pi rcc5 hyphen o then resources dot py file and then the name of the file resources.qrc okay so this file resources.qrc should already present in your label img hyphen master folder okay we need to have this file also created so when we run this command what will happen uh it will create this particular file as well so resources dot py file in your label img folder okay so let me show you first uh so you can see that resources.qrc file is already there right press enter and you would see resources.py file also created now now you need to move these two files resources.py and resources.qrc inside this libs folder so just cut and paste them inside this libs folder if you don't execute this step or copy these two files in the libs folder then your chances are that your installation is not successful okay once you do that you need to run one command now python then label img dot py in order to initiate the label img tool or in order to open the label img tool so press enter and then you will be able to see a window of label img so just like shown here so using this particular tool i will show you how to label all the objects in the given image so you can open any image by clicking on this open button and then browse to the location where you have kept your image that you want to annotate or label so here is my image i have loaded into this label img tool now on the left hand side you would see various options here there is one open dir button so using this button you can open the entire directory of images then we have change save dir button this button is to basically change the directory to new directory where you want to keep your new annotated images then you can use next image and previous image buttons to scroll through images in a given folder if you see it down below you will see these two downwards arrows okay just click on it and then you could see you have options to zoom in zoom out fit to a button fit to width button to clearly see the parts of the image to better annotate them so now let's label an object in a given image okay so just create a click on this create a racked box button and then draw a bounding box around that so you could see that i have drawn a rectangular box or bounding box around the object which is pizza you would see a pop-up window appeared on the screen so just name it as pizza and then click on ok so on the right hand side you would be able to see the label appearing okay in inside this particular window right now on the left hand side you could see that the format of this image currently is pascal slash voc so just click on this button on the left hand side and change the format to yolo so you can see that format is changed to yellow now and now you can click on save button and browse to the location where you want to save this these annotations so click save so as soon as you perform this operation you would see two new text files created inside the folder which i have selected from the browse button so this was my location where i saved uh the annotations and you could see these two new files created already now the first file with the title classes.txt holds the class names or label names and second file contains the annotated image in yellow format let's open this classes.txt file so you could see that one entry with the name pizza is there in the classes.txt file and that's the entry which we actually labeled in the image now let's open this second file so it shows various numbers here so first entry which is this 0 entry suggests the location number of the class annotated since pizza is the first entry in the classes.txt file so it is showing the number as 0 because indexing is starts from 0 in this label img tool next number is center point x of the labeled object next to it is the center point y which is the point center point y of the labeled object next number is this object width and next to it is the object height these entries such as center axe center y width and height ranges from 0 to 1. these values are normalized such that object's center x value is divided by image width objects center y value is divided by image height objects with a value is divided by image width and object's height value is divided by image height now let's go back to the label img tool and try labeling few more objects now let's label this particular object and name it as soft ring then label it as laptop so you could see that i drew a rectangle of y bounding boxes around those two objects and labeled them as soft drink and laptop now let's go back to our two txt files and see the entries there first uh we need to save them okay so save it and then let's see those two files now so you could see that as soon as i created those two new labels soft ring and laptop there are two new entries in the classes.txt file and two new entries in the pizza drink.txt file and this is with respect to these two labels i have created which were soft drink and laptop so you can see that there are two separate entries for soft drink and laptop in two new rows and you could see the location number center x center y width and height values for the soft drink and laptop entries well let's see i want to change an existing label okay so let's say i want to change the label uh from soft drink to soda here okay so change the label and click ok once you click ok the label has been changed from soft drink to soda now so you can do that and just click on save button once you do that a new entry with the name soda will be created in the classes.txt file at the location number three so this is location number zero one two and three so a new entry will be created at the location number three for soda now let's see the corresponding pizza drink dot txt file which is our second text file so you could see that the location number for soft drink has been changed from one to three now this is because we have corresponding entry for soda at location number three rest everything else will remain same but just location will change oh yes one more uh thing uh in order to follow yolo format guidelines and standards every image needs to have a corresponding text file with the name same as our image file so what am i talking about here is that our image name is pizzadrink.jpg so we need to have the annotation file with the same name which is pizza drink dot txt so the title or name of these two files will remain the same only the extension will change and i'm talking about annotation file and the original image file now let's come back to the label img tool if you want you can uh hide these bounding boxes okay and the way you can do it you can just uncheck this these labels and the bonding box will disappear so you can see that bounding boxes for these three objects has been disappeared right let's bring them back now you can also perform several types of operations by right clicking on these bounding boxes so you can when you create right click on the box you would see a window appearing it says create rectangular box edit label duplicate rectangular box delete rectangular box etc so if you click on duplicate box a new box will be created which you can drag and drop and in fact you can drag and drop on another object and annotate it so folks this is it for this video in the next upcoming video i will cover another important topic of yellow v4 series so here is today's question state true or false image annotation or labeling is required for only classification types of problems please post your answers comments in the comment section given below so that i can get a chance to incorporate your feedback you can also post a technical questions in the comment section and i will try to answer the same if you are watching this video and you are not already a subscriber to our channel consider clicking that little subscribe button in case you have already subscribed then click on the bell icon to receive the notifications whenever i will release a new video so thanks for hanging out with me guys i will be covering next topic in the upcoming video so keep on watching thank you
Info
Channel: The AI University
Views: 109,121
Rating: undefined out of 5
Keywords: yolov4 object detection, what is yolov4 object detection, yolov4 object detection crash course, how to develop object detection model, label images labelimg, how to annotate image dataset using labelimg, annotate image dataset labelimg, label images using python, annotate images using python, label images for object detection, label images online, annotate images for machine learning, annotate images for object detection, yolov4 free crash course, Annotate images python, YOLOv4
Id: 1d7u8wTmA80
Channel Id: undefined
Length: 17min 56sec (1076 seconds)
Published: Tue Sep 01 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.