OK so now let's start building our first CNN model.
We will be using the same data that we use for classification problem in and then here the task is to
identify the fashion article name depending on their images.
We have 10 categories of different objects.
We have t shirts trousers words and for all of these articles we have their 28 by 28 pixel grayscale
images.
We have already created a neural network model for this classification problem.
Now we are going to egg convolution a layered width of it and then more than that.
So let's just start by importing some of the important libraries.
We are importing numbed by a US and my Lord then we are also importing tens of law and get us
then as I have told you earlier we will be using fashion and honest data.
This data is available in get us datasets.
For more information you can click on this link here.
We have our own 60000 images as our training data and another 10000 images as of our test data.
We have ten different categories all these categories are label from 0 to 9.
And this is this index.
We are going to use the import fashion amnesty data.
We have already done this in our aim in tutorial.
So I'm not going to spend our time on this
so we are importing over data and to explain full why train full x test and Vi test variables.
Let us just run this now since we have labels for all these articles.
We are going to create a list with their description so that we can refer to this list whenever we get
a class label.
So let's create a class name.
This also.
Now we have to do better at reshaping this Donnelly change.
We are going to do in three processing of coin delusional neural network as compared to an
if you remember four.
And then we convert it over to the images into a single one dimensional array losing light and function
but for CNN we need a three dimensional array as input.
We need height weight and also another dimension for channels.
Currently we have our X data in the form of this.
Good images.
There is no another dimension for channels since these are simple grayscale images but by default for
CNN layers we need a three dimensional images.
So we are going to reshape what external data and we are going to add another dimension to our data.
So earlier we were using commandeered by 20th pixel images.
Now we are reshaping it and 228 and 228 and 2 1 1.
It stands for channel and again we have 60000 images in our training dataset and 10000 images in the
work as dataset so before doing this reshape the shape of our extreme full dataset was 60000 across
28 across 28 now for convolution on neural network.
We are adding another dimension for the channel as well.
So we are just adding another dimension to make it four dimensional.
Just on this.
Now we have reshaped our data.
The next step is to normalize the data so all lower pixel values are between 0 to 255.
So we are just going to divide our entire dataset by 255.
In that way all lower values will lie between 0 and 1.
We already did the similar thing for a word and then model as well.
So I'm not going to spend much time here.
Similarly we are going to split our dataset and do train and validation sites.
We are keeping 55000 images for our training the desert and dress of 5000 images for our validation
dataset.
So let's just on this as well.
So first 5000 are going into validation and from 5000 to 6000 are going into training data set.
Now let's say the seed for a word then sort of flow and number so that we get the same result every
time we run this code.