Hi and welcome back in this lesson, we'll take a look at training your own vision, transform a classifier
in careers.
So let's open the book 61 and we'll begin to lesson.
So firstly, this column book comes from the official Karats tutorial site, and the credit goes to
Khalid Salama for creating this.
So what are we going to do?
We're going to train a vision, transform a network, a pretty simple model on the Sofar 100 dataset
so that Safa remember Safa attend to SAFA 100, which has 100 different image classes.
So firstly, you need to install TensorFlow add ons, which I've already done here.
So now let's load our libraries so we can begin to listen.
So as I said, we have 100 classes and input.
Image size for this lesson is 32 by 22.
And you can see once a download data which might take.
Shouldn't take too long, it's downloading pretty quickly.
You can see the number of in the shape of the training dataset, as well as a test dataset here.
So you can see we have 5000 images in the training set and 10000 in our test set.
Next, we need to configure some type of parameters, and for now, we can just leave this at the default
settings here.
If you wanted to experiment later one, you can be just manipulating these parameters.
I would encourage any number of epochs or learning rates, as well as with the key parameters.
Maybe they can help but shouldn't help.
Too much should still converge eventually.
So now we're going to create our data augmentation of transform.
So we're using random flip resizing, normalization, random rotation, as well as random zoom.
So let's do that and now we need to implement our multilayer perceptual and the MLP head of the network.
So let's do the deal.
Next, we need to implement the patch creation, and we're created as a layer here.
So let's create this class that those two patch creation here.
Now we can you can display the patches if you want.
There we go, see this.
I have no idea what this image is, which someone could tell me.
But anyway, this is what the image looks like as in the patch structure here.
So, yeah, so all good so far.
Now we need to create the momentum or the patch, including Leo.
So let's do that as well.
Remember the different building blocks we need for this?
And finally, we need to build a V8 model.
So this function here creates uses the players we created above to patch layers and all of those things
to create the multiple layers of the transformer block so you can create multiple layers here defined
by the number of transform lives.
And finally, returns the model here.
So this is a very good exercise if you want to figure out how we actually build these models here.
Now this is a run that we trained the networks you can see with Defined Optimizer.
We can pop up, compile a little model here and set some other points here where we only keep the best
suites as well.
Then we just have the history where the model is trained so we can look back and plot some graphs and
then we just load the last.
Well, the best model using that checkpoint felt that returned from the checkpoint above, and then
we just evaluated the model.
We get accuracy and top five accuracy, and we print this out and we return to history so we can plot
those graphs after.
So let's create our classifier here and then we can run the experiment.
So let's do this.
This may take a while to train, but we'll see how it goes.
There's a summary here that shows us that after 100 epochs, the VAT achieved zero 55 percent accuracy
and 82 percent top five accuracy.
Now, that's pretty decent on so far so far 100, which has 100 classes.
However, it's not that competitive compared to make cities resonate 50 version two and which achieves
67 percent accuracy, which is much better here.
So to do that, to get better results, what you can do is use a pre-trained VAT and then fine tune
on this target dataset.
Like I mentioned in the slides before, that's probably going to give you better results.
I haven't actually experimented with that too much, but it would be an interesting project or homework
lesson for some of you guys to do.
So I'm not going to wait for this to trigger the 100 epochs, so it's going to close this off after.
But you can.
And if you want to examine the results and see if you get anything better, you'll feel free to do that.
Clubmate books are free, and if you want to get access to the GPUs, you can upgrade to Core.
That proved like I have.
It's just 10 U.S. dollars a month and I'd say it's pretty much would it if you're going to be using
GPUs a lot.
So maybe for the time that you have this course would be a good idea to upgrade, to call out proof.
Anyway, that's it for this lesson.
Thank you for watching.
And in the next lesson, we'll take a look at some other classifiers.
So stay tuned for that.
But.