TensorFlow Tutorial 3: Object Detection Walk-through

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello again everybody and welcome back in this video we're going to perform a walkthrough and tensor flows object detection functionality so let's go ahead and get right into it so I'm gonna link this in the description below but just in case you'd like to know how to get there without the link if we type Gita chibi github microcontrollers and more and then we go to here and then we go to repositories and then we're going to go into this here tensorflow Tut three object detection walkthrough and then we're going to go ahead and clone that and you can clone to wherever you'd like I'm going to clone two documents so we have to jump in here and get that directory extension here so we're going to go CD to whichever director you'd like to clone to and then get clone and then we're gonna go to clone or download and copy that and there we go so there's our two commands so then we'll go ahead and bring up a command prompt and then we're gonna go ahead and do that and there's a second command and this is a pretty small repository so it won't take too long at all to clone and it's almost done there we go all set so now we're gonna go into documents and there we are tensorflow taught three object detection and walkthrough and so we've got this word document and PDF document so you can view the PDF document if you don't have Microsoft Word but I'll go ahead and open the word document and then so we're going to dive right into it here so the first step is I'd really suggest to complete the previous two videos in this tutorial series so I'm going to when I'm done with the videos I'm going to put a link to them here and then here are those repositories as well and so the second step is really you know I would definitely suggest completing the first two tutorials before this one you may encounter some error messages or I might say some things that don't make sense so please complete the previous two tutorials if you have not already so continuing on we're going to clone the repository containing this document so actually we just did that so now we can go on to number four so we're going to follow the tensorflow object detection API readme installation instructions so if we go to let's see I'll show you how to get there rather than take a look at the link here so if we do github tensorflow and then that will take us to here so then if we go to tensorflow so here's all the tensorflow repositories as you can see there's quite a few that - I seems to gravitate to over and over our tensorflow and models so if we go to models this is what we're going to clone today and it's actually a pretty decent-sized clone takes a moment my internet connection is not the fastest so to save some time I already cloned that to downloads and it's right here models and I should also mention that what we're going to work with today mostly is in the research director here so if we go to research and then we look for object detection which is right here this is mostly what we will be working with in this tutorial today and in the models repository if we go to the root of the models repository here that is to say we'll find some different directories here one of which of course is we just took a look at is this research directory so from what I understand about how the tensor flow models repository is structured when something is still kind of under development to a degree it's put here in the research directory and then when it's ready to be sort of more officially released its removed from research and then put into this structure here so we can anticipate that probably eventually object detection will be moved out to here but for the moment it's in research so that's something to keep in mind if you're watching this tutorial six months to a year from now if that change is made and some other changes are made to this process as it's still under development I'll probably rerecord this video eventually but I can't rerecord the video every single time a minor change is made I can't update the walkthrough document so that's something else to keep in mind is if the walkthrough document and the video differ you probably want to file the document because that's generally speaking going to be more current but in any case continuing on here so if we go to research and then object detection and then if we go down to here we will find these installation instructions so these instructions are written with different definitely an orientation towards Linux and Macintosh use and I'm doing this video on Windows today so there are some changes to what we're going to find here and the walkthrough document reflects that so let's go ahead and get right into it so we're going to start with opening up an administrative command prompt so definitely wanna remember it administrative one so you're going to right click on command prompt and then go to more run as administrator and I don't know if this shows on the recording but it just asked me do you want to allow this app to make changes to your device yes of course we do and then you're going to simply copy and paste these commands in here one by one so in my case this isn't gonna do much because they should all be installed already requirement already satisfied in XML requirement already satisfied Jupiter and that's gonna have a whole lot of lines here but they're all already satisfied and should be the same with MATLAB and pandas as well and there we are so we're all set there so now we're going to clone the tensor flow models repository so we're going to create a directory C colon backslash tensorflow and let's see here so if we go to this PC and then C and then ok so before I continue on there's a few steps I have to do to get my computer so it's probably the same as yours is at this point so I'm going to delete that and delete that and then I'm also going to go into system and I'm going to undo a few path variable changes and then I'll explain later on how to redo these changes so if this doesn't make sense at the moment that's just fine so pythonpath we're going to delete that and then we will go into path and then it and then we will delete pythonpath and okay and okay and okay you know at this point my computer should be configured pretty much the same as yours so continuing on with the cheat sheet here so if we copy tensorflow here so we're gonna make a directory and we're in the C Drive root of C here so we're going to make a directory here tensorflow so now we've got C colon backslash tensorflow and then we're going to copy models into that location so when that's done then we're gonna have C colon backslash tensorflow models so then continuing on with the walkthrough document the next step is we're going to download and compile protobuf so we're gonna follow this link here to Google's protobuf repository and I'll show you quickly what that looks like here so you're gonna choose releases and you're actually gonna skip past the first few releases here most recent few releases I should say and we're gonna go down to three point four point zero and I'll explain the reasons for that in a little bit so here we are three four zero and the only Windows download choice is this one right here so whether you're using a 64 or 32 bit computer you're going to choose protec three four zero one thirty two dot zip and then actually I've already downloaded that to save some time today so we can close out of here and close out here and that is let's see that's this download right here prototype three four zero one thirty two dot zip so then we will go ahead and do extract all and then extract and that extracted to do a refresh so it resorts that that extracted two right there and we're simply going to move that directory to the wrote of the C Drive as well so if we go here move to C and there we go so before you continue you're going to want a fare of I verify that you have those two directories so you should have C colon backslash tensorflow models with this content in it and you should also have C colon backslash Pro tock three four zero one thirty two with this content so continuing on the next step is to compile protobuf so we're going to CD to see tensor flow models research and then we're going to run this command but before we do that let's take a quick look at the proto's directory here so if we open yet another file explorer and then we go to here so here is this directory see tensor flow models research object detection proto's and you see there's all these proto files but there's no dot pi files yet and the reason for that is because we haven't yet performed the compilation process and that's one command line command to do that so we'll go ahead and do that at this time so we're gonna copy this to a command prompt let's go ahead and close out of that get a fresh command prompt here so there we go and now we're going to enter this command to perform the compilation and if this works which it just did there you won't get any feedback here at all I wish it had some kind of message here that says something like compilation successful and unfortunately doesn't have that but if you go to the proto's directory you will now see that indeed there is a PI file that was not there previously for each proto file so that tells us the compilation was successful along with the fact that we did not get an error message here and maybe I should explain this command a little bit further here so let's bring up the command prompt so first we're specifying here to run proto XE and the reason that we're specifying the full path here is because we did not add C protag 3 4 0 132 bin to the path so the command line parser here would not know what we're referring to if we just put protec XE so that's why we specify the full path and then the second parameter here is object detection protostar dot proto so what this is doing is this is referring to all the files in this directory that end in proto and that's the reason I'm using protac three four zero is because something to do with the newer versions of Pro talk it I think the star character they don't seem to be able to handle that correctly I should probably file an issue about that on the protic github but at least for the moment hopefully that will be resolved eventually but at least for the moment it's probably best to stick with pro toc three four zero because we know that will work so we're all set on that step so continuing on we're going to test the tensor flow object detection API using the pre trained model within a Jupiter notebook so if we see d2 tensor flow models research object detection we're going to find a let's see what goes out of this now and we close out of this now and so let's see well let's whoops do that take a quick view of this directory here so if we go to see tensor flow models research object detection you will find this object detection tutorial that IP ynb this fill is not familiar this is a Jupiter notebook so if we CD to that in a command prompt and then we enter this command here at Jupiter notebook that will bring up that file in the Jupiter notebook format here in a browser for us and Jupiter notebooks are kind of popular at the moment I still prefer a traditional Python editor especially pycharm makes writing both Python programs very user friendly here but to follow along with Google's installation instructions so we're gonna run this here object detection tutorial i py NB and then we're gonna choose cell and then run all and that jumps us down to the bottom here and this has to download a model so it will take a moment but once you get to the actual point of doing the object detection which is this loop here it's actually pretty quick so we need to wait just another moment for that so while we're waiting for that let's explain what the next step is so the next step is we're gonna run this script here zero verifying models and protec install that PI and that is going to be let's see so if we go back to documents and then tensorflow object detection tensorflow to three objects action walkthrough that's going to be this that we're going to load up and at first we're going to see that there's going to be an error because we did not yet tell this script uses a library util which is located at C tensorflow models research object detection and then utils that is all this content in this directory right here is the utils library and we have not yet added that to the Windows path that was actually what I deleted at the beginning of this video or a little bit earlier on so we're gonna riad that and then you're gonna see that that's going to resolve that error and if this doesn't make sense at the moment it will shortly but let's go back to the Jupiter notebook okay so this is all done running so there are two dogs and an image being detected and here's an image of people and some kites being flown at a beach and those are being detected so that worked so we can go ahead and leave that and we don't need that anymore and we don't need that anymore so let's go ahead and open this verify models and protec install so we're going to keep an eye out for those two import utility are going to be a little bit of the way down into the script and again that maybe I didn't mention this earlier but this script is basically the Python notebook that we just took a look at this is essentially just a regular Python program version of that so if we go down to those two import statements where are they they're right here and once PyCharm is done loading up you can see it's got this progress bar at the bottom where it's still parsing some things these should be underlined right eventually we may have to run the script to get it to do that and let's go ahead and run it and there we go so module not found error no module named utils and you'll notice these two lines with utils in them are underlined right so here's how we're going to fix that is we're gonna go to let's see we're going to go to system advanced system settings environment variable system variables so if we go down here and type system and then we go to advanced system settings we don't need this window anymore so now we can go to environment variables and then the top section here is only for the current user but we'd like to edit this bottom section here for all users so then we're going to create a new environment variable let's see so go to system advanced system settings environment variable system add a new variable with the name Python path and try not to grab an extra space there so we're gonna go down here to new variable name pythonpath and then we're going to enter these five values and if you only enter one of them like that and then you choose okay and then you go down here to Python path and edit it still gives you this awkward view where you have to enter a semicolon and then the next one but once you've entered two of them separating with a semicolon of course then now if you go to edit it gives you this the Windows 10 at least gives you this nice window where you can copy and paste in line by line so then we'll copy and paste this in and then next one and generally speaking this seems to take the spaces off the end for you if you have one but it's always a good idea to check and then this here and then we can paste that in and that's good okay so now we're going to choose okay and now we're gonna add Python path to path so how we do that is we specify percent Python path percent on to path so if we go to let's see up here just a little bit path edit and then down here we enter path and then choose okay and there okay and then okay and now we're gonna bring up a command prompt spring up a fresh one and then we're gonna type the command set and then we're going to check our variables here so there's Python path just as we entered it and the percent Python path percent should expand this content in python path into path so if we look here tensorflow models models research models research slim azure source object detection so sure enough there we go so our path variables all set so continuing on basically the installation instructions that we took a look at earlier we're actually almost done with those at this point it has this mention here of add libraries to python path and this export command this is really if you're using mac or linux what we just did is essentially the windows equivalent of that and then it has this next part here about testing the installation running this model builder test pi file you can go ahead and do that but honestly if you run zero verify models and protagonist all it runs without air then at that point we verified the installation so go ahead and start a PI term and do that and honestly really really running this model builder test isn't isn't necessary so we're gonna open your verify models and proton install and then this progress bar at the bottom right is still loading up a little bit and hopefully we will not get red underlines under these to use lines you can go ahead and start that now and go ahead and run it and we should see the same two scenes so the two dogs and then the people and the kites at the beach and give it a some okay so there's the two dogs being detected and there's the people in the coats at the beach so our install is all set and one thing that I should mention before we continue on is the next step is download images for training and testing but just to give you a little background the model that we've been working so far with with so far is using this Microsoft cocoa common objects in context pre-trained data set and they trained on I believe it's tens of thousands of images in each of these 90 categories here for these 90 objects I should say and when I was looking for a relatively common object that I could find images on the internet for it was actually pretty difficult to find one that wasn't already one of these ninety so eventually I decided to choose traffic lights in a traffic scene even though that's already here but um if you follow the steps in the remainder of this tutorial and to do that basically we're going to go through these five Python scripts basically just one after the next you can follow the same steps for anything and that will work to Train anything you know you could train something more specifically that's in this set of 90 or you could train on any object you like so we're not any further from the rest of this video we are not leveraging the pre-done data set with the traffic lights already in there but rather we're training on our own images at this point from from iran so continuing on with that the first thing that we have to do is we have to get our images so I downloaded a little bit more than a hundred images of traffic lights in a traffic scene and save those to my Google Drive and onedrive file-sharing services so these two links here are identical the only reason that I have two of them is just in case one ever goes missing if I accidentally move something or it's deleted somehow at some point then the other will be available so you can go ahead and download either of those and of course I already did that ahead of time to save some time so if we go to file explorer and then let's see here downloads and that's going to be these here traffic lights that zip or traffic lights that simple the numbers one of these is the Google Drive and one is the onedrive one I don't remember which is which but it really doesn't matter so we can simply do traffic lights and then copy that to here and then paste and then that one zip it and then we can go into here and here's our 127 images of traffic lights so the next thing that we have to do is we have to use this program where I should say get to use this program because this program here label image is fantastic and what this does is it's going to why don't I go ahead and start using it and then maybe it'll kind of make sense as we go so we're going to go to this label image github so you can follow this link right here to get to it so thank you very much - this kind sir here I don't know how to pronounce this person's name but they wrote this program that's absolutely fantastic so you're gonna want to go to label image here and then you're going to want to go to actually I think it's better rather than a go to releases there's some nice instructions here on how to use the program again it's a very user friendly program it's pretty intuitive but you're gonna want to go to download pre-built binaries windows and linux and you're gonna want to download the most recent version I don't see any reason not to get the most recent one as of this writing it's as of this video recording I should say it's a 1-point 6.0 and I have a whole bunch of instructions here to kind of spell things out in a little bit more detail you can refer to those if you like but I'll just kind of walk you through it quickly in this video here so um I already downloaded that - let's see see Program Files and I believe it's here we are label image version one point six point zero and then this is the content you're looking for and you'll probably want to make a start menu shortcut or pin to your taskbar a shortcut to this label image so then we can go ahead and fire that up so in just to refresh our memory here in our downloads directory we have this directory traffic lights so we have all these traffic scenes but we don't yet have XML information notating where in each image of the traffic lights are so there there's two traffic lights there there's three etc so that's what this program label images go and allow us to very easily do so let's go ahead and start that up and it takes just a moment to load so we're going to choose open directory and then we're going to go to let's see downloads and then traffic lights and then we're going to select that folder or directory and you'll notice that this program very nicely lists each of these JPEG files here for us and these are listed in ASCII order not necessarily numerical order so for example it goes 110 100 because 1 is the first digit in each of those and then eventually when you get to one that does not start with 1 then it'll get to 2 down here and so on sand then it goes to 20 21 so the order it's something to keep in mind there but in any case that doesn't really matter so if we expand this out so this program is a very user friendly here so you can control a mouse wheel to zoom in and zoom out and if you mouse over a certain like I'm going to mouse over the top left corner the image up here and then mouse wheel in it'll zoom in on that corner and then of course you know similarly if you want to zoom in on the bottom right corner and then you can mouse wheel over that you can mouse over that rather and then Mouse will zoom into there so that makes zooming in and out to certain locations very easy there unfortunately there is not like a left-click and pan feature that's maybe the only thing the program is missing but it's very easy friendly otherwise so that's really not a problem so if we zoom in on one of the traffic lights here and we draw a box like so and then it will ask us how do we want to classify that so we'd like our XML to come out like this here so we are going to I'm gonna copy and paste this to make sure I don't make a typo while I'm making this here so we're gonna call that traffic light and you're gonna see we're gonna end up with this XML in just a moment so if we paste traffic light in there make sure you don't have any spaces or anything and choose okay or alternatively herewith says use default label you can paste that in there and then check that box and then we scroll over and there's only one other traffic light in this image so we simply choose create wreck box again draw another wreck back surround that and then you can choose save and the program is intelligent enough to figure out to save it in the same directory that you are already working in and it will save the image as or it'll save the XML file rather as the same name as the image file but of course it will save the extension is XML rather than jpg so if we choose save there and then we go to the next image and I'll just do one more of these just as a quick example here there's no sense in me going through 127 of them so if we go like this and then we're gonna do another rec box like this and trying to get lined up right there and then there was a third one in this image I believe yes there was there we go so create rec box and there we go and then we're gonna choose save once again and then save and then you could choose next and go on to the next one again I'm not gonna go through all those could be very time-consuming but if you open XML so let's take a look look at this so it tells you the directory name and the image name you don't have to update the path if you move this around because for the rest of the process that's actually not used and there's some other information here these width and size of the image and the depth is the number of channels 3 but the especially critical information that we're interested in here is bounding box and this gives us the x-men Lima and xmax and ymax of that box we just drew and of course there's two of them because we drew two boxes so then similarly when we go to tendai XML where we do three boxes now of course there's three of these traffic light objects with the bounding box specified so to save some time while I was making this video obviously if you're doing this process again to detect you know totally your own custom object that you're going to train you'll have to go through however many images you have but the label image program really is pretty user-friendly it makes it pretty quick to go through it however still to save some time when I was doing this video or if you'd like to just skip on to the next steps and not worry about setting up the XML files yourself at this point I did download let's see here or upload I should say the those same images with associated XML files created also to my Google Drive and onedrive so then you can go ahead and download those so let's see here and of course I already do the head of time to save some some time in recording this video so if we go to downloads that's what these here are traffic lights with info and then traffic lights with info so these two I forget one of these is the onedrive and one is the Google Drive I forget which is which but again it doesn't really matter so we can delete this traffic lights directory from earlier and then if we go into traffic lights with info and then we can choose copy this and we'll paste that into downloads and that takes just a moment to extract so there's our 127 images and each one has its matching XML file so at this point that's actually most of the legwork now we pretty much run these five Python scripts successively and I would be a good idea if this is the first time through the process I explain a lot of the things in much more detail in the walkthrough document but to save some time in this video I think I'm going to just kind of run through the scripts and I made the error messages when running the scripts absolutely as user-friendly as I possibly could so if you forget a step most likely there'll be an error message that should be pretty friendly as far as suggesting what to correct so for example if we open one XML the TSV PI this is going to translate the XML information we just downloaded in some CSV files which is necessary for the next step which changes those CSV files into TF record files which is tensor flows recommended storage method of data which is necessary to then feed into the next step where we're going to Train so if we go ahead and run this here one XML to CSV type I of course it's going to give us an error message because we didn't create in these images or any of these directories rather yet so or the training images directory that it does not seem to exist did you set up the training images so we did not so what to create actually why don't we just move this so we can do traffic lights with info we can move that into the repository we've been working in and at this point we don't need the Downloads directory anymore so we're going to rename traffic lights with info to training images and once again there's our hundred and twenty seven images each with an Associated XML file so now if we run this it's going to say error we didn't separate separate out any test images I believe test images directory does not seem to exist so we're going to create a test images directory so new and test images so now we're going to go into training images and we're going to just randomly pick out so seven let's pick out say ten image and XML file pairs to test on later and of course we don't want to train on those same images so we're going to move those in to test images first so that's one two three four five six seven eight nine and ten and taking care to make sure that we choose the matching image and XML pair for example don't accidentally choose one sixteen XML and one 17 jpg so I'm kind of making sure I do that correctly as I go here so we're gonna move those into test images and sure enough there's our ten pairs of images and associated XML files moved into test and we now have two hundred thirty four divided by two remaining images in training images which is a sufficient number to Trina and really want more than a hundred images to train on so at this point we can go ahead and run XML to CSV pi and we should not get any errors so converted training XML to CSV conversion successful and then test XML to CSV can conversion successful so what that script did for us is it set up this training data directory and these two CSV files so let's just take a quick look at the format here so each line in the CSV file corresponds to one not one image file but one so for example you recall that image 10 dot jpg there were three boxes that we drew so sure enough there's three lines in here and then these last four numbers of course are those box coordinates so that worked successfully so now we can run generate TF records and we need to give PyCharm just a moment to load up here and then the next step when we're done with this is going to be to run well let's go ahead and run this first so it'll take just a moment here for PyCharm to do its parsing pre checks here and then we can go ahead and run this just a moment yet to process this is running okay let's go ahead and journey generate TF records and successfully created successfully created so we're all set there so now if we go back to training data again now we have trained at TF record and a valid TF records so that was successful and now we're going to open up train and this script takes on my computer with a little bit more than a hundred images to track not it takes quite some time takes four and a half hours because I don't have a GPU in this computer also this is not the latest and greatest computer out there so if you have a newer computer or if you have a GPU this may take substantially less time for you if you have an equivalent computer it'll probably take about as long so this is something you may want to start you know just before you go to bed kind of thing and then leave your computer running overnight but in any case we still have to download a model yet so we'll go ahead and run this and it's going to tell us we have to download a model I believe it will take just a moment for tensorflow to load up of course that's what the delay is here tensorflow is as you would guess a rather large library so while we're waiting for that will bring up the Downloads directory so okay there we go so here the model directory that does not seem to exist did you download it and extract the model from the tensorflow models repository detection zoo so we did not so we're going to open that now I don't know why that opened twice but in any case a tensorflow detection models ooh so there are a number of models that we can choose from here I'll kind of explain these quickly again there's substantially more detail in the walkthrough document where I'll aberrated on this a little bit but to make a long story short SSD mobile net via one is as the name implies that's intended for mobile processors so if you're running something that streaming video on say from a webcam where speed is really essential you'll probably want to go with mobile net whereas these others and over here you see speed and accuracy this cocoa MAPI one is a measure of accuracy the higher the number the better generally speaking so some of these other models here are trained for more particular purposes depending on what what type of object you're detecting out at what type of scene some of these might be better however generally speaking for still images where speed is still important to a degree but not as essential as for streaming video probably SSD inception v2 in most cases is going to be the all-around best choice so that's what we're gonna go with today so I already downloaded so you're gonna go ahead and click on this and then download that and I already did download that to save some time and recording this video so if we go to downloads and then this here Assisting inception v2 koko 2017 eleven seventeen tar.gz and then we copy that over here and that'll take just a moment copy we don't need the Downloads directory anymore so you'll want to download 7-zip so seven 7-zip and let's see if you have a 64-bit computer which you probably do you're gonna want to go ahead and download this right here install it if you have not already and once that's done then you'll have this nice context menu 7-zip and then extract here and that's going to on the first extraction is going to extract the tar.gz into just a tar and then we're going to go 7-zip and extract here again and that extracts to this directory here SS the inception v2 Co Co 2017 11 17 go ahead and verify that there's some contents there which there are and if we start this one more time we're actually going to get a temporary error here and I'll explain that in a moment and the reason for this error is because you do have to bear - I mentioned earlier in the video the tensor flow models repository is still kind of under development and I actually have a pull request out to the tensor four models repository as well as an issue that I filed to fix this concern basically there's a parameter okay here we are so tensor flow models research object detection data decoders TF example decoder dot line TF example decoded at Highline 110 and I did not put this in the walkthrough document because I hope this is going to be fixed very shortly but for the moment this function call here image does not seem to actually have this DCT method so the fixer that's very easy simply delete the comma on the previous line and then delete this DCT method equals DCT method so you're going to delete just what's highlighted there I'm going to press backspace and then pipe I charm is going to remind me that this file does not belong to this project yes we know that and we want to edit this file anyway choose okay and now at this point when we go ahead and train the training process should begin successfully and again this takes about four and a half hours on my computer on yours it may take less if you have a newer computer or GPU but at this point I'm going to stop the recording because this takes pretty much all the memory of the computer to run and I don't want my screen recording to crash and watch the screen lose the screen recording that I've done so far so just once again give this just a second here to make sure this is started okay and then I'm going to stop the recording okay it looks like it's starting well so I'm gonna go ahead and stop the recording now okay so back edit here our training process just finished so this is more or less how things should look when training is done and I'll go ahead and sweep back up to the very top so you can see this is a quick view of how things should have looked like this we got into the training and then you can see here this steps are counted I can count it up incrementally step one step two step three etc my computer takes roughly 30 seconds per step again if you have a newer computer it's better than this or GPU especially that may be substantially less and I included a screenshot of how the training process should start out and then also what it should look like at the end in the walkthrough document so you can reference that if you have any concerns or if you're experiencing any errors for for comparison but in any case that completed successfully for us so we're go ahead and exit out of PyCharm and we're just about done here just two quick final scripts to run so we're gonna run export inference graph pie and that's going to create a graph a directory rather in our working repository here that I believe is called inference graph we got a give by term just a second to load up and then after that we can go ahead and run tests and these scripts don't take very long I think export inference graph only takes perhaps a minute or so to run if even that and we just got to give pycharm here another minute to load up so we'll take a quick look at the walkthrough document okay there we are it's almost there or waiting here okay it's late it's over and we're almost ready to go here so again this follows a pretty similar format to to the other of these five scripts in a row here we're running so there's function here that checks if the necessary pass and file is exist but I think they're all pretty much made since we've completed the training process so we can just go ahead and fire it up here so export inference graph and we need to give that just a minute to load again this import tensorflow is TF line always takes a moment because of course tensorflow is a pretty large library to load and then we should see the inference graph directory appear in here eventually i believe i just got to give it another minute so we'll shoot to the bottom of the walk-through document here so for the next step we're gonna run test dot pi and then we're gonna find this is one example result let's see how this is doing still gotta give it another minute here and what we're gonna find is that we're going to get about I found about sixty percent roughly accuracy with finding these traffic lights and the reason for that is because we only trained on a little bit more than 100 images if you wanted a really production grade accuracy well more on that in a moment here this is running here okay so starting script calling training valve train eval pipeline config etcetera etcetera converted for intent variables to constant ops and done so we're all set there so we can go ahead and open up test and while we're waiting for that to open we'll take a quick look at the inference graph directory so you can see that process just created these files here for us so that worked out well and now test should be almost open here and we'll give this just another moment to load and so as I was saying earlier we're gonna find about 60% accuracy with finding these traffic lights and depending on which random images you take out and separate to test on later versus which ones you train on that will be a little bit better or worse and the reason that that isn't extremely high I mean that this would be really really high if not for the fact that we didn't use enough training images and also we set the number of steps down you may recall in this SSD inception v2 config file the default for this and you can reference the original file from Google here by following this link if you're so inclined so then you can see what settings we've changed four and a half hours is pretty long to wait for training so here's the original so let's see I believe they have num steps at the 200,000 that would give probably better accuracy but to keep the training time down to something reasonable I set num steps down to I believe it was 500 here and then the other thing would be just using way way more images instead of just a little bit more than 100 if you used say 10,000 images of traffic light scenes and then increase the number of steps to perhaps 5,000 you'd probably get upper-90s percent accuracy but in any case we'll go ahead and run it with what we have so far and hopefully we'll we'll see that we get at least sixty or so percent accuracy depending on which image we separate it out so that's pretty good two for two on that one and that one we wouldn't really count the backwards facing traffic lights so and these ones in the distance are kind of far off but these two here ideally should have been detected and only one of the two was so we'd call that maybe 50% in this image none of them were and it's something to do with the sky in the background or the lighting it's hard to explain and this one one of two was detected so obviously we'll miss this one on the right here but the one in the center is go detect and then in this image we got two out of three so that's pretty good and in this image we got both of them that's especially good being that this one that we detected up here is one of these kind of odd sideways slanted ones and then in this image out of it looks like there's really five that we should have gotten we got three of them so again that's right about the 60% range and then here we got one out of two so and then this one we got two out of two so that's pretty good and that one we miss them all so it's kind of a under miss thing with this few training images if you're trained on way more images it would be super super accurate so that completes this tutorial and these first three tutorials so we did a installation on tensorflow and walked through the first few programs and the first one then we did classification and then object detection in this tutorial so um some ideas I have in mind for the next tutorial is I'd like to redo either the second or third tutorial in C++ I'd like to redo either the second or third tutorial in net there are some very good new Ghia packages that are dotnet wrappers for tensorflow and another thing i'd like to do is get Jupe GPU and go through the configuration process and then do a walk-through on that as well so if you have interest in any of those options please comment in the comment section below please rate comment and subscribe and I'm not sure when I'll have the next video out but eventually and I'll see everybody in the next one
Info
Channel: Chris Dahms
Views: 47,446
Rating: undefined out of 5
Keywords: TensorFlow
Id: rWFg6R5ccOc
Channel Id: undefined
Length: 42min 21sec (2541 seconds)
Published: Mon Mar 12 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.