Right to touch with our own image.
We can go online and download some images.
I'm just gonna download some cuts images
I'm gonna go to Google dot com my computer.
I don't know it's running a bit slow.
Okay.
We can download a few
cannot right click this save this
occur this empty one
then.
How about this one.
Save this I empty too.
Let's try this.
Save this I empty three.
How well we probably.
Mix it up.
I'm gonna search car image as well.
NOBODY'S SAFE THIS I empty for a c
c of us.
I am G five K.
Oh we try a bird.
We got lost to image
I empty six.
Okay so let's take these images and put them in our images folder.
Come here.
Fetch these.
This is my project forward.
I've got an empty photo here called images right.
So let's test the images and then I can close this.
Okay so I'm gonna come down here and um I'm gonna see if this actually to create a new safe point.
Call this number eight.
And I'm gonna see um my image a cause and we can just take one of the images.
Let's start with S. I MDG 1 the JPEG that S J peachy like this.
And then the name of the file we know we can locate it in our images folder in the name of the image
is my image name right.
So once that is done we're gonna see it image a course and Pitot array and then we're gonna do.
And the image that I am read then we pass the file name and the path and then flatten
it course force
once that is done we gonna see my image.
Because Sy pi dot miscellaneous dot image resize
we need to resize it first.
What we're gonna do is post image here and then the size here is gonna be um the size of our standard
image which is this the height and weight of the of the images that we use we're gonna use resize it
to the size num underscore p x number of pixels.
So I'm gonna pass this size over here.
It's gonna be a number of pixels by a number of pixels and then
I'm gonna see a dot reshape
then I'm gonna pass one over here then the number of pixels times number of pixels transpose right.
So this will give us the um the vector that we wanted a column vector which our neural network accepts.
So I'm gonna say my um
C AMG prediction.
Because then I'll call it a predictive function and what I'm gonna do is take the weight by accessing
our dictionary and passing w here to get a weight and then the bias as well.
We find it in the same dictionary b over here and then the input is my image.
Here we can show the predicted image we can show the um the image by saying BLT.
I m show.
And then um we simply pass image we post this here and then we can print the result as well and um we
can simply do print.
The prediction is an SDR.
I'm gonna squeeze the dimension by doing MP dot squeeze and I'll show you later on the difference between
using squeeze and not using a squeeze.
After we run this experiment and what I'm gonna pass us argument here is my empty prediction here.
Right.
So yeah this should give us the resort.
I'm gonna do POTUS show over here
okay so I've passed I am g 1 this is I am g 1.
Let's see what a neural network is gonna say.
Gonna run over here run module
okay.
Creasy.
Test like reach the 70.
Close this
I am Reed.
We have an error.
It says a..
Image has no attribute.
I m Reed.
Okay.
A C right.
Um yeah.
Let's inspect our code.
Um what we did
I read okay.
We probably have a different version of PSI pi to have to reinstall the.
So the decide package and then um.
Oh [REMOVED] yeah.
Also there's a mistake.
Remember our image has three channels so we've gonna multiply by three over here.
When we reshape it right we have to reshape it to the the column vector that our neural network accepts.
Right.
And we saw how to do this earlier.
So we simply use in this hyper library to reshape it.
But it seems this a library.
No it's not it's not playing ball.
Okay.
Let's see whether it works.
After fixing this.
If it doesn't.
Would have to revert to a different version of spy or click here to run the module.
Okay.
What does it say.
Wait we have something near
it says I am resize is deprecated.
Okay.
Wait.
If you you're still in work then this is what we have to do.
I'll show you perhaps some of you still have the arrow.
You come to the installation folder where we install the python installer here you go to the script
photo within the installation folder and then I'm going to hold on shift right click and then open come
on window here and I'm going to on install side by or do Pip
on install side by
and then you would ask Do I want to continue.
Say yes and then it says successfully on installed.
Then I'm going to install Sai pi one point one cause those image root functions are from Sai Pi I think
get deprecated now.
That is why new installations might receive such an arrow.
Later on we would um we would have to use the other library such as the p.
Uh the python imaging library pill and perhaps not plot lib to reshape and read out what images we would
have to do that later.
But now we can use IPA.
So I'm gonna do pip install pi.
You cause one point one point zero like this then I'm going to hit enter.
So he's gonna take a while to install the um the side pi.
So if you receive an arrow about with regards to um image read then you would have to.
You would have to reinstall CI pi it successfully installed.
You just might take a longer time.
It's fine.
Okay.
So once that is done verify that you have this here.
I'm gonna click here to run
it's learning
Okay
it's what we have.
And this is somewhat image image number one and the prediction is zero
this is strange.
So it failed to predict this accurately.
We have some warning here it says image resize is deprecated and will be removed at one point too.
Okay so we can install we can use SDK major so we can use ASCII image for this next time.
Okay but let's try our neural network once more.
So the first prediction s supposed to be a cut but we the the resort we got was results for no cut.
Let's try.
Image 2
prediction 0 again
the prediction is you mean this also is not a cut I cut into the cut into the solution.
Okay let's see.
There has to be something wrong somewhere.
So let's try image 3.
This is a major three major three say Cut.
Let's try that already tried this.
Let's try it 3 and see what we get.
Image number three when I run over here
this is a cut and the prediction is 1 1 means.
True.
So this was predicted correctly.
Okay let's see image number for this car.
Let's see.
I'm gonna select image number four over here
okay.
Image number four.
Prediction is zero.
And as we know image number four is not a car.
Let's to image number three again.
I realize that the resort was out of the window as I was reading it to you.
So I'll come back to major number three and show you what that prediction said.
OK.
It says 1 but have to reshape this.
So we have it over here.
Prediction is one meaning.
It's true.
It's a cut right
and then.
Let's see the next images image number five.
Let's see what the car is going to be confused.
That's it cut
when I run
okay.
Prediction is zero.
Meaning it's not a cut and this is correct.
Let's see the last one you made.
Number six is the bird.
Let's see what a prediction is going to be.
What does going to be confused for a cut.
Okay.
This is zero.
This is not a cut.
So it seems our new network.
This work and well it it performs better find in non cut then um then find an actual cut mean meaning
if you show a picture that is not a cut it's definitely it works better by telling you this is not a
cut.
It s performance is better when the image is not a cut but when you have an actual cut it's performance
sometimes is food.
Sometimes you would see a cut and it wouldn't predict that it's an actual cut.
And like I said this is not the best way to implement image recognition.
This just experimental.
We would see a better fit.
We would see um we would have two versions two new versions of the same implementation detecting cuts
versus not cuts.
We would go and use a deep new network to do it.
And then after that we'll try convolution on your network.
But I would advise that you try this out and then gets more cuts images and try it out and also play
with the um the lending rate as well as the number of iterations to see if its performance can improve
and you can throw some other images of known cuts and see if you can get it to confuse something that
is in a cut for a cut.
So far we've not seen it but when we've seen it it won't.
We have seen so far.
Sometimes you give a cut and it says it's not a cut but we've not seen it tell you.
This is a cut when it's not a cut.
What I mean is we've not seen the neural network confuse a known cut for a cut but we've seen it confuse
a cut for a known cut.
So yeah you should experiment with it more but yeah this or the rest for this lesson if you have any
questions just send me a message if anything at all.
If you have suggestions or you know you just want to run TiVo or something then or you just want to
say something which regards the course you can message me and I'll see you later.
Have a nice day.