At this point we finally understand how to fully build a convolution or neural network in python.
Now we're ready to outline the upcoming code as usual.
I'm going to repeat the steps of our analysis just to be sure.
Step number one is to load in the data for the following examples.
We'll be using more difficult datasets in particular fashion amnesty and see 410 fashioned amnesty was
designed to be a drop in replacement for the amnesty data set which today is considered to be too easy
for modern machine learning algorithms one might consider it to be a solved problem.
Thus fashion amnesty was born and it was designed to be a standard benchmark just like amnesty but with
the goalpost further ahead just like amnesty it's a data set of 28 by 28 grayscale images and it even
has the same number of samples.
The difference is that instead of simply handwritten digits we have images of different types of clothing.
For example t shirts shoes pants and so forth.
Your job is to classify these images into the correct category.
The CFR 10 data set is older but more difficult.
This dataset contains color images so the data takes up more ram and the images are also a bit bigger
32 by 32.
It contains classes such as automobile frog horse cat and dog.
You can already imagine that with such tiny images it might be very easy to mistake a cat for a dog
or a dog for a horse
step number two is to build a model.
Luckily we just discussed that in painstaking detail over the past few lectures.
In case you forgot we'll be using convolution or neural networks
step number three is to train the model.
Step number four is to evaluate the model and step number five is to use the model to make predictions
just like the.
And then section.
Nothing here changes.
These steps are model agnostic.
As per my rule all machine learning interfaces are the same one new thing you'll learn about later on
in this section is what to do if your data set is too large to fit into memory or if you want to augment
your data.
For example we know that a dog facing left is a dog but a dog facing right is also a dog.
So should our CNN not be able to recognize both of these orientations as a dog.
The answer is yes.
We also know that deep learning loves data.
The more data the better.
This is why deep learning has come to prominence in recent years so data augmentation is a method of
virtually adding more data without actually having it.
We'll discuss this more later on.
But for our initial example we're going to keep things simple
so let's elaborate on step number one loading in the data.
Luckily both the data sets we'll be using for these examples are also included in torch vision.
It's generally going to follow the same pattern as before you can even probably try to guess the function
names and you might be right for a fashion M.A..
We load in the data by calling torture vision that data sets that fashion feminist for a CFR 10 and
we load in the data by calling torch vision datasets that see 410.
Nothing too surprising there.
Inside the training loop we can loop over the data sets in batches by using the data loader which you
guessed it looks exactly the same as before.
So what changes.
Other than changing the model and changing the data functions.
Nothing really.
So this is a great time to remind you of my two rules.
All data is the same and all machine learning interfaces are the same
so just as a quiz.
Let's think about which of these steps will be the same and which will be different.
First the training loop as you know we'll be doing Batch gradient descent.
Will this be the same or different.
The answer is the same next question.
Let's consider evaluating the accuracy of the model.
Will this be the same or different.
The answer is the same next question.
Let's consider plotting the confusion matrix given the model predictions and model targets.
Will this be the same or different.
The answer is the same
the only minor non-trivial thing I want to highlight is that the classes are going to be encoded as
integers from 0 up to 9 inclusive.
But how do we know which integer corresponds to which class.
For example what if zero is dress and one is teacher.
Is that obvious.
Of course not.
I just did the easy thing and look them up on the Internet and hardcoded them as strings this way when
we look at the misclassified samples.
It won't say something like 0 is misclassified as one which doesn't really mean anything but rather
t shirt as misclassified as Drescher which is more interpretable.