Building an Object Detection Model with the ML.NET Model Builder

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone so in this video i'm going to create an object detection model pretty much from scratch and i'll be mostly following this tutorial on the microsoft docs here detecting stop sign and and images and we'll be using model builder and we'll also be using azure ml to do the training for us alright so in here we will have a link to our data set once you have that you will extract it out and it will have this folder of 50 photos in it and there's just photos of stop signs in there and so what we're going to do is we're going to create a model that not only tells us there's a stop sign in here but where in the image it is so it's going to detect the object in the image and one of the biggest things about kind of doing this from scratch is for the model you have to tell it where the bounding boxes are and that's kind of a bit complicated because you're not sure what dimensions or what what exactly the data that they want for those bounding boxes and then not only that but you have to calculate those bounding boxes but to help with that microsoft has uh this tool called vot which is visual object tagging tool that can be used to help us out and it is i think there is a web version but we'll be using the uh the desktop version here so we go to the latest release here on github down here we'll just get the windows version or whichever version depending on what machine you're running and for more there's also an interesting microsoft doc on how to use fot for labeling your images for object detection and so i'll link these in the description and so once you have that you'll open it up and it'll look something like this and we'll go ahead and do a new project and we'll create a few things here we're going to call this stop sign detection generate a new security token and for our source connection we're going to add a new connection we'll call stop sign images and provider you can go from bing image search which is in pretty cool also from azure blob storage but i'm going to use from our local file system so i'll select the folder that's going to be in that stop signs folder there actually just set this source connection to what we just created there in our target connection this is where our exports are going to be so i'll just stop sign target and i'm going to do local file system again i'm going to select that same folder that i did before and then i'll do that i'll set that i'll keep all these kind of as default right now from our local connection here i found all the images and a couple of things here one thing on the right side we have our tags and we can add a tag and i'll say stop sign there and on the left side here of all of our image previews you have this couple icons here so this first one we visited and see the elements don't have it yet because we haven't even touched them if we go to it we'll have this visited sign on it let's go back to this one now in order to do some tagging we can just use our mouse here and kind of click and drag to get the region and we can click on that and we can go up here to our tag and click on the tag that we want to associate that with all right and then you see this icon changed to tagged so we know that this image has been tagged we go to the next one we have two items here we'll select this one instead of clicking on this each one on this tag each time is notice that there's a number next to it so that's a hotkey so we can select one on our keyboard to quickly tag this item do the same here and then i'll go through all of these and tag them alright so now i have all these items tagged and in fact if we look down here in the toolbar of vod we see we have 50 assets that we've visited and all 50 have been tagged so that's kind of a quick way to see that we've tagged pretty much all of our items then next we're going to click this item to export our project all right so exported correctly we're going to go back to our item here so we got a bunch more files here so each time you tag an item it creates a json file and we'll open one of these real quick and there's quite a bit of information here just information about the image itself so it's the jpeg the id the path and the name the size and all that but it also has the regions so the bounding boxes and then the points of it name all right so we have that and so i already have a console project loaded here in visual studio so i'm going to do the add machine learning to build up model building and we'll create an mbconfig file here so i'll do stop assign detection all right so it's an object detection item and you see we can only do it in azure ml so we have to set up our environment here and so we can click here to set up our workspace and we specify a few things here we look at our first we need to specify our subscription that we want to use and then if you have a machine learning workspace it'll be populated here so i have one called gpu workspace and in fact we have it here that i've created before and then with that we need a compute now i don't have any valid azure computes on this workspace so we can create a new one and i'll call it object detection and compute size i'll just give it standard nc6 and these are all gpu enabled compute sizes and the priority i'll just give it dedicated now click create now it's going to take a couple of minutes to create all right that created and let's take a quick look at what that did here so i'm going to go to compute and see what it's already actually created here but our computer instances uh that didn't get created here in fact it created in the compute clusters and that's uh looks like it's going resizing right now and we go back and we'll click create on our experiment here so we have our environment set up we'll click next and we get our data here and we need to select a json file with image labeling and so we can go to that folder that we use for our vot project and and here is a little bit tricky because we have all these json files how do you know which one to pick the one you know to pick is going to be in this json export folder and it's going to be whatever your project name export dot json so you use that one and that gives a preview of some of the data including some of the tags in here so it looks good so we go to the next step and then we can start training notice we don't specify the number of seconds to train because everything is all handled in azure machine learning and so we click start training and it's first going to upload all of our data to azure to be used for azure machine learning and now this can take quite a bit of time so i'm going to pause here and we'll come back when this finishes all right so our images have been uploaded and it's kind of starting to train already and we can monitor our run in the azure portal here just we can see a little bit more details as to what's going on and we'll see that it it is running here and you have the child runs and it is running a child run there so we can get a little bit more details all right our training completed here we have a model and you can see here best accuracy is a hundred percent now if you see that that's kind of a indication that it might be over fit but we'll continue on here that we can evaluate our model we can browse an image we can take one of our own images and see how that works so i found the stop sign there that's 50 we can change the score threshold so go back see this one here is not a stop sign it's only 31 percent confident but we say well we only want items that are see greater than 70 so nothing shows up all right so that's one of our own items and let's do let's go back to unsplash and we'll download a new item that it hopefully hasn't seen yet so let's see i think this one i don't think you've seen this one yet i'll just do the medium one use this image all right so i found this is a hundred percent confident that that's the stop signs and work pretty well we can change our threshold let's go to the next step and consume step we'll check out this console app and add it as console f here we'll mark this as the startup project and notice the mb config file came in along with that and that program just takes one of those images that we found kind of a random image or random sample of our data and it calls the predict method on our stop sign prediction which is in the mp config file and the consumption and also has our our model file and the onyx model from azure machine learning you'll notice the input class has the image source so that is the location on our machine of the image after the predicts it just loads the model chris prediction engine and then does the version engine.predict so we can run this real quick there we go so i found three items here so the first one was almost 100 scores of 99.7 percent the other ones are 30 so we might ignore those and it also gives us the label that we can put in and it also gives us our bounding boxes so we can use that in our own programs to draw bounding boxes all right so that's pretty much how you can create your own object detection model using model builder and azure machine learning hope you enjoyed the video and thanks for watching
Info
Channel: Jon Wood
Views: 12,518
Rating: undefined out of 5
Keywords: ml.net, ml.net object detection, model builder, ml.net model builder, ml.net model builder object detection, model builder object detection
Id: 0ZPqLjbEPRk
Channel Id: undefined
Length: 10min 29sec (629 seconds)
Published: Thu Sep 23 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.