Hello.
Welcome back.
So currently our image is still not a column vector.
We saw the dimension of our image.
Let's see.
So this the dimension the dimension of our images still.
Um well this the dimension of the entire set.
But we know the dimension of the image at least is sixty four by sixty four by three.
We've got to change this into a column vector.
We've got to change this into just this.
We have got to make it like this mean in one column and then over 12000 rows.
And once we do this for a single image for the entire image sets we're going to have these number of
columns number of columns will be equal to the number of training examples a number of rows will be
equal to this number.
We have to flatten each image to a column vector.
That is what we have to do now.
That's the pre processing we need to do.
So let's do the math and I'm going to comment this.
I'm going to say it again
call this number three and then
I'm going to form this once we are done we can clean the format we can clean the comment.
Yeah but I think if it's your first time doing this will be nice to have the test point for test it
before it becomes complicated all of a sudden yeah.
So
so we going to come down here
and then I'm going to say
Qur'an set X flatten we're going to flatten the image and all we're gonna do is take train sets X original
and then we're going to use a function on us reshape so a dot reshape
what we want to reshape is train set one or reshape it to this train set X original index 0 and then
minus 1 and then the transpose of this right we're gonna do the same for test set X
and go see the
right index here over here
and then transpose once that is done we can print out the result and see what we have
you can see a new image shape is then we can just use the STAR function and then I'm simply going to
call this
the sentence does and so on repos
Chris set X shape is this okay.
And then we're going to
check the tests at
right.
We already saw the um the shape of the of the Y.
We know the shape of the Y already.
It was one by two hundred and nine which is the um which is the number of images oh just this you'll
see I'm going to copy this and bring it over here.
Nice view this as well.
If you forgot and then I'm going to copy this controversy to copy put it over here.
This has to be screwed contra s when I run this run module
only into just color arrays can be converted to escalate index.
Okay let's see where the error lies.
Yeah.
So over here I forgot to change the word here to test this front and see what up this is the cause of
the arrow run module.
Okay.
Green set X flatten train set X or reshape the train set.
X okay
yeah.
The courses from here.
I forgot I was extracting the shape that's index 0.
Okay.
Control s run module.
Kind of reshape array of size this into shape of this okay.
Um yeah.
Sorry about that.
It's my fault.
During my copy and paste in this is the mistake I made over here.
I should be typing I should create a new variable I meant to create a new variable by changing this
word here to test.
So it's as if we were trying to reshape Um this this one again.
That is why we received the arrow.
Let's see now.
So we have train sets X flatten test set X flatten and we have you in train sets X flatten test sets
X flatten.
Okay.
Run module
we still get in the same area.
Test set X flatten test set on a score.
Original 3 shape.
Uh yeah.
There with me.
It's from here.
Um I'm sure some of you have a go at me in the review section.
Just bear with me.
Yeah.
Um yeah.
So yeah.
Yeah.
This the last type.
Yeah.
Okay let's see now.
Okay.
Voila.
Yeah we go so we don't have a go at me.
Yeah.
Okay.
So um let's see.
Train set X shape is this and then it's printing out into shape.
Okay we'll fix that later.
So we have the Y shape we know this already the Y set is one by two hundred and nine one by number of
images we saw this.
Let's see if our image shows this.
We said we're going to take Y we're going to take all of y values and store them in a vector like this.
So it's one dimensional in a way.
So one by two or nine we have this stored like this.
This is stored in a real vector we have we have multiple rows single.
This is stored in a row vector we have multiple columns a single row and this is the one for the test.
Okay.
Right.
Okay.
Let's shorten this
okay so what I meant to print was Dot shape not the entire thing.
Okay.
Control is to save
Okay so that's the shape of our train set.
X this is the shape now by the number of images.
This the dimension of a single image.
So this here represents the number of rows we have.
This represents the number of columns and we can verify that from our image.
Right.
As you can see a single column starts from zero and at twelve thousand two hundred and eighty eight.
And we've got multiple columns the number of columns we call equal to m m means the number of training
examples.
And over here we have two hundred and nineteen examples hence we have twelve thousand two hundred and
eighty eight by two hundred and nine.
And we have the same image the same image type but this time 50 of them for testing.
And then we spoke about the Y already.
So yeah.
This the pre processing required in order to to feed the image to our neural network.
So these this the flattened version is going to be the the version we feed into the neural network.
Like we discussed in the theoretical class this all there is for this lesson if you have any questions
at all.
Just let me know.
And sorry for the um the typos and all the other stuff but certainly you can have a go at me in the
review section and um simulator.
Have a nice day.