Now, let's take a look at our digital order.
So what is a detail exactly?
Well, and pretty much how we get data into the neural net where we training it is by using something
called a digital order and what it is and what it does.
It basically returns to data from the from the training dataset.
And remember, this has over transforms.
So we have something.
So it creates an object called a train loader.
And with this, we can set about size, which I'll explain to you shortly how it works shuffle, which
means it's going to pull the data randomly.
It's randomly shuffling the data so we don't pull it in a sequence and number of workers, no number
of workers as a parameter that allows you to control how many CPU cores you want to utilize in this
data loading operation.
Now it's a good parameter to mess with if you want to experiment with different speeds.
I tend to leave it at zero in most cases when I'm doing it on Cloud Atlas.
However, you can set it up to because I believe the idea there's a dual CPU, one club or even one
CPU sometimes.
So you can experiment with this, but generally leave it at zero.
OK?
And you can see we create a little louder.
We create two data ladders.
We create one for training data and one for a test data.
So now let's take a look at what the data object returns.
So if you're familiar with some more advanced python, you would know what an item it is.
So Oteri is an object that basically allows you to retune and iterate a little pointer to an object
so you can actually accesses objects quite quickly.
It's a good technique when you're trying to do optimal programming and improve the speeds.
So instead of pretending to actually do this is a much faster to do so.
By using the Python data function, we can extract this and make it into an item.
It's a hill, so we have data to know.
So what does that allow us to do?
Well, it allows us to access the first batch of data from our data.
So by creating this data, creating a data iterator from our train loader, we have data data.
And then by applying the DOT next function, it gives us the batch removing specified about size of
128.
It returns a batch of data, so the images and the labels, which is exactly what we want to use when
training at CNN so we can actually print the sizes of them.
These are tenses again, torch tenses so you can see it does return exactly what we wanted.
One hundred and twenty eight images, this is adapted up to that shifted now, and it's 28 by 28, and
the levels are basically the classes zero to nine and it returns one hundred and twenty eight, which
corresponds to a class name for each image.
So that's exactly what we want, and you can see if you wanted to check the image dimensions of one,
you can see it's exactly as we expected it one, 2020.
It just accesses the first index of this images from the batch we extracted here.
So alternatively, I'm just going to show you quickly another way we can plot images using to experience
one of the utilities called Maigret.
It's actually quite simple, and we actually use the data loader to create this.
So by creating the ideal reader from our train loader, we get data later here and then we just use
the next to get to batch like we did before we create a simple plotting function on top here.
And then we just used a simple function to watch creation utils.
Don't make grid.
Take all 128 images here and use them show function to display it.
It's quite simple.
And if you wanted to actually print the labels, we can just print the labels by just putting it into
a little list comprehension here.
Extract out all of the values from the labels here and print them together in a nice way like this.
Not really that nice, but at least we have all of the class names here, so you can see it's Zoom in
a bit.
Two five five one seven can see the sequence here.
The class labels two five five one seven six nine eight and so on.
So that's that's what we call a batch and remember and mini batch.
This a gradient descent.
This is what we use.
This is the batch we feed into the neural network.
Get the losses applied back propagation with the optimizer, which is stochastic gradient in most cases
or whatever, optimize that you want to use and just keep doing it again and again a bit more batches
of data.
So let's stop there.
And now we'll take a look at the real nitty gritty here.
How do we build a CNN invite?
OK, so I'll see you in the next section.
Thank you.