Hi, guys.
Welcome back to Lesson 43.
We will take a look at creating a mass detector using the TensorFlow object, detects a library and
we're going to train a mobile net SSD.
Remember SSD single shot detectors?
So let's take a look at this lesson.
So again, just want to reiterate that these notebooks have been adapted from Ramon Flow.
Oh, it's mostly the same notebook, however I do.
I do often have to make a couple of little changes here, and these are the credits who actually for
the guys who actually created this full notebook because these things are actually pretty tricky to
create in a club environment requires a lot of custom configuration.
But once it works, it's I mean, that works.
It doesn't work forever, though sometimes club can have some updates that do tend to break these up
to connect to scripts, unfortunately.
So I've already run a lot of these blocks of code.
Here you can see it takes zero seconds to run.
This is just simply some configuration and some variables were defining.
Then we have to select TensorFlow Vision 1.0 because the TensorFlow 2.0 doesn't support the object detection
API just yet.
It might be supported, actually.
Actually, it is what it is right now, I believe.
However, let's just keep it at TensorFlow 1.0 here because everything in this notebook works and it
should continue to work once it's in TensorFlow one point x thing, it's one point one for that call
up ships with when you set it to this vision, I do, actually.
I have trained recently an efficient detect model using TensorFlow Object Detection API in TensorFlow
two point four.
I believe it's 2.6 right now, but I don't think it would actually do the work in 2.6 if I remember
correctly now.
So anyway, sorry for rambling.
So what we do know we run the report, the TensorFlow object detection repo here, and this is from
the URL that we set previously up here.
And so let's just pull and tortoise repo.
Then we install the required packages.
This might take about a minute to forty nine seconds on my club, so roughly the same on yours.
Then we just navigate to the directory.
We get data sets and placed them in the correct place.
Then we just make sure all of TensorFlow actually has to have two files for the records it has for the
dataset annotations.
There's the PB text file, as well as a t.f record file, so we just make sure those on the right directories.
Then these are the we have data to record names from a sell them, sell them or not to send it to our
files so we can have these pointing to the correct directories here.
This is the CoLab Library part.
If you were running this in your local system, you would need to change this.
We shouldn't be too much of a big change as we remove the content part of it.
Next, we download the pre-trained model.
That's a base model here.
So we get that.
And then we just we just run some tests there.
We just check the model checkpoint directory as well.
Now we start configuring our pipeline.
As you can see, as I mentioned before, there's a lot of things that are quite confusing because it's
more, I guess you could say, software development, software engineering style stuff that goes on
in configuration configuring these notebooks.
But nevertheless, it's not that hard to follow.
So we just set we create a function to get the number of classes from the PB text file.
Then we or what else do we do?
We just set up our training pipeline here.
We have two parts being set here as well, so we can create all those files if we need to.
And then we just check the pipeline name here, which is all the settings that will be training.
This model would take all its configuration so you can see this.
This is a way.
It can check everything to make sure because it's going to pass this file when you start training here
and look at all these settings.
Next, we can run the tests of what optional?
Not sure if it's working because they know and grok, which is what we used in Split did make some updates
that prevented it from being used easily and cooler.
Although in the later lessons with the web app and web and API rest API, I do show you how to fix that.
So for now, maybe this works.
Let's check it out.
There doesn't seem like it's working downward downward.
It's some support.
But actually, that's not even the end brookvale.
Sorry.
That's just the install file.
Yeah.
So no, we're training the model and you can see this is our training results as we go.
You can see it doesn't give us all of the nice map and lost stats that we would we would want to see
all of.
We do have an overall score here, although I'm not sure which locks it is, but nevertheless it is
a metric we can use to monitor, and you can see that gives us a time per well, looks like every 100
steps.
Not sure if that's what the e-book settings are here.
We probably could go up and check.
But nevertheless, it is training.
And I remember, if I remember correctly, this model doesn't actually take that long to print, which
is pretty good because it's a mobile SSD.
It's quite quite a lightweight model, and it gives a very good performance, especially if you convert
it to flight model.
You can get 10 to 20 frames a second on modern Android phones with this model, which is quite good
because that was something that maybe five years ago required like a desktop GPU to get that kind of
performance.
So, no, we can just check the performance metrics here.
You can download a Model five if you wanted to.
Yeah, we don't actually display actually, as we do, we do display the inference and some test images
here, which we will see shortly.
This is all a set up here.
So I'm not going to go through that could run before I should run after a few.
If it doesn't run properly, just message me and I can look into the bug.
But now you can see it's looking quite good.
You can even get to God this guy's gas miss, which is a bit extreme.
So all of these must be detected.
This one isn't two, and this one isn't.
So you can see it does have some issues with some black mass.
However, it's getting most of the mask here, and this is a remember.
I should say this is a lightweight model, so we could probably lower the confidence threshold if you
wanted to detect more mass.
But remember, you probably get some false positives at that point.
But you can see it's looking pretty good.
Not sure why this blood tests this blood one is that they just think it's a mistake, but you can see
it's looking quite good.
Quite interesting.
OK, so that's it for this lesson.
In the next lesson lesson 44, we'll take a look at a sign language detection, and we're going to use
the same TensorFlow API setup.
However, the principal object detector API setup, but hub of a hover, we're going to train the fish
and detect model, which gives better performance than the mobile SSD.
OK.
So stay tuned for that lesson.
Thank you.