All righty.
The most exciting part of dog vision the reason why we built this in the first place it's so when I'm
sitting at a cafe or when you you're sitting in a cafe and you take a photo of a nice dog and you come
back here and you want to check what breed of dog that was.
You can.
So let's make a little section making predictions on custom images.
And this is just another version of processing our inputs passing them to our machine learning algorithm
and then verifying our outputs when we're first starting with machine learning we were first starting
with deep learning.
This is what we're focused on what are our inputs what are our outputs how can we use an existing machine
learning algorithm which we already have to figure these two out.
So let's go here and what do we need to do.
So to make predictions on custom images well actually let me just show you the custom images first so
I've got three dog photos here.
There's my Poppy.
We've seen that one before that seven Bell is actually in the background might confuse our model a little
bit.
There's another photo of baby Bello and she was so small.
She's a lot bigger than that now and there's a recent photo of Bella sitting on one of our couches just
chilling out staring at the camera with those big brown eyes.
This is a beautiful thing about working on a deep learning project that works with dogs to look at photos
of dogs so get the file parts.
We need to get the file parts of our own images are actually my photos are currently stored locally.
So we might need to upload them here.
Actually what I'm going to do is create a new folder while I'm uploading these images I want you to
think about what do we have to do to the inputs of our machine learning model
dog photos.
What's the most important thing when we're preparing our inputs
Well if you said we have to convert them to numbers you be correct.
And if you said we have to convert them into the same type of data that how machine learning model was
trained on you'd also be correct turn the file parts into data batches using create.
This is where our function is coming back into play.
Create data batches.
Yes.
And since our custom images won't have labels because that's what we're trying to find out.
We set the test data parameter to true and then we pass the customer image data back to our models predict
method and then we have to convert the prediction output probabilities to prediction labels.
So making them in something that we can understand and then compare the predicted labels to the custom
images.
That's a bit of a challenge but it's nothing that we've seen before.
Looks like a lot but we're going to take it down.
So let's get the custom image file parts.
We'll set up the custom path and we just did that.
So that's gonna be drive slash my drive slash dog vision slash chores at my dog photos.
That's where I just uploaded three of my own dog photos so you might want to upload your own dog photos
to here if you have some.
I hope you do and then we go here.
We're gonna get a custom image paths Eagles a little less comprehension again.
Plus f name file name for F name in ours.
Don't list.
So this is like the gold standard of what you're doing with your machine learning model.
Once you've trained it it's one thing to use it on data you've been provided.
But what we're doing now is using it on our own custom data.
Oh no.
There we go.
So we should have some custom image paths.
What was I saying.
This is yet a gold standard of machine learning and deep learning as is seeing how your model.
I can't even type right now.
Why hasn't this work for S F name in Dawg vision.
Custom path plus f name for F name in OS Y is in this work.
Oh do I have to rerun this
empty list.
Mm hmm.
Always do list.
Custom path.
Have I not uploaded any dog photos there.
That is why it is not working.
Classic.
Let's upload my doggy photos.
Got distracted talking too excited.
Open that so this is gonna upload shouldn't take too long because it's only three photos.
If you're using more data I'll probably find a different way.
There we go.
Now we'll come back here.
This should work fingers crossed and it does.
Now what do we have to do.
Well we need to create data batches.
So this is what we can do.
Turn custom images into batch data set so we'll go custom data equals create data batches.
This is our trusty little function that we've written many moons ago but as I said it's going to come
in handy one day.
Custom Image paths will pass that there and then we'll check out custom data.
All remember because this has no labels we need to pass it in as if it's test data.
There we go.
Batch data set of the shapes.
There we go.
Images 2 2 4 by 2 2 4 by 3 in the form of T F floats.
Our custom images are in tenses so we can make predictions on the custom data.
How do we make a prediction with our model custom spreads loaded.
Full model don't predict custom data.
Yes please.
We'll have a look at custom threads.
Can you guess what shape this will be.
We've seen that before.
We're getting hot.
We're getting hot in here.
Custom threads yes three images.
So we've got 120 prediction probabilities for each one.
And now what do we have to do.
So now we've got a prediction of right.
Let's convert them into labels and then compare the labels with each image.
So get custom image prediction labels and we're going to go custom pred labels equals we're gonna go
get Fred label.
Wonderful.
Pass it custom Fred's eye for I in range.
Len custom parades.
Now this is just a little comprehension to get the prediction label of the custom pred eye for range
length custom parade.
So for each one get the Red Label custom Fred labels all we are kickin have a go at this.
So now we need to get the custom images a.k.a. UNbacked Wi-Fi on our own batch of five.
Function won't work since we don't have any labels.
That's one little tidbit that we could probably improve out on batch ify function later on but for now
we will get the custom images out on batch ify function won't work since there aren't labels.
Maybe we could fix this later because we're on a roll.
We don't want to start while we're hot.
We don't want to stop dog vision is coming to life.
We'd like mad scientist here hacking together we've gone home from the cafe so distraught that we've
built an entire day learning model to help us figure out what dogs were checking out for image and custom
data.
We just need to um batch it so we'll go on batch.
So remember this is going to unwind our data batch into just images and into something that we can iterate
over because we're using as Num pi iterator.
So custom images dot append image does that make sense so we've got an empty list.
We're unpacking our batch custom data set.
We're turning it into an iterator and we're appending each image to custom images.
Shifted into one last cell I reckon checked Custom Image predictions.
Now we want to plot it up.
We want to plot it up like we've done before.
Right up here.
But because we don't have labels we can't really use our function up here.
That's a bit of a booboo.
So we might have to re fix this function at a later date as well that might be a little challenge for
yourself.
Now we go right back down to where we were.
Check custom predictions.
I'll tell you that figure we're going to go figure size equals 10 10 and we go for I image in enumerate
custom images.
So if you're not sure of what a numerator is it's just going to go for the images in custom images count
them up save the count of it to I and save the image inside custom images to image and we're going to
go APL a dot subplot 1 3 I plus 1 three columns one row and this is the index of our subplot that's
what we get I want to get take on X takes said that to non to get rid of that yucky Ness we just want
to see see how pitches in their full light belted out y takes peyote a title custom Fred labels I peyote
don't aim show image.
So the title is just gonna be the label that our model has predicted and image should come up.
So are you ready.
Dog vision in the flesh.
Oh how good is that.
So this is the picture of baby Bella Lakeland.
Terry I'm not actually sure what a like land Terry is I think we have look that one up images
OK you can kind of see why it looks like that because Bella in baby form is real fluffy around here
and then that seven golden retriever which is exactly right what she is and Bella is a Labrador Labrador
retriever that is phenomenal so dog vision has fully come to life you should be ecstatic with yourself
if you got to here.
Now I need you to do me a favor if you're in the Dischord chat and you've made it this far and you've
made some predictions on your own custom images with your dogs please share them I want to see your
dogs and what our model that we've built has predicted for them and is it ride or is it wrong maybe
you could add that to this functionality you could make the name because you know the true labels of
your own dogs or maybe you don't.
So maybe you're trying to figure it out that's the purpose of dog vision.
That was our end goal right from the beginning.
So if we come here we've gone look at all this headings you should be so proud if you've made it all
the way through here we've gone from right up the top.
This notebook builds an end to end multi class image classifier using tensor flow to intensive flow
hub we defined our problem we defined our data from Kaggle we have defined our valuation we've gone
through a bunch of different features we've got our workspace ready using tensor flow to energy you
we've got our data ready turning it into tenses we've seen how many different dog breed images there
are you've got the images and the labels my goodness how much have we covered go back through all of
this and give yourself a pat on the back and if it all doesn't make sense don't worry if you've gone
through for the first time it's not going to but what this is it's a momentum builder Let's go right
down to the bottom what we've done we've gone through we've got our data ready we turn it into tenses
we've picked a model to suit our problem image classification using tensor flow hub a.k.a. a neural
network a deep learning neural network we fit the model to the data we've made predictions we've evaluated
our model by visualizing our predictions we've improved through experimentation by trialling out a model
to make sure that it works on a thousand images first before scaling up of course there are some more
improvements that we can do I'll leave that some extensions in a lecture after this one that you can
have look at and we've seen how to save and reload our trained models that is phenomenal you've made
it through holy goodness I am so stoked for you.
The important thing is to remember that this is a momentum builder you've now gone through a full blown
end to end machine learning modeling task you've gone through these steps a tenser flow workflow so
now you can adapt the principles that you've learned all throughout this notebook on different problems
you can go Hey I know if I'm working on a different problem I might not know exactly how to solve it
but I've got evidence that I have actually been.
End to end on a problem that I hadn't seen before I've got a set of data I've turned it into tenses
I've tried to model on a GP you I've made predictions on test data and then I've made even predictions
on my own custom data you should be stoked with yourself so please share your predictions on your custom
dog images if you have them I would love to see them make sure you tag me in the discord but otherwise
I will see you in the next video and I'll leave some extensions for this project as well as different
resources in the next lecture that you can check out.