‫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, you and you are 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, when we're 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 puppy.
‫We've seen that one before.
‫That seven Belle is actually in the background.
‫Might confuse our model a little bit.
‫There's another photo of baby Bella when 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.
‫You have to look at photos of dogs, so get the file paths.
‫We need to get the file paths of our own images.
‫Or 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?
‫My.
‫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'd be correct.
‫And if you said we have to convert them into the same type of data that our machine learning model was
‫trained on, you'd also be correct.
‫Turn the file paths into data batches using.
‫Create.
‫Oh, 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 a custom 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.
‫Whew.
‫That's a bit of a challenge, but it's nothing that we've seen before.
‫It 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 going to be drive slash my drive slash dog vision slash.
‫What was it?
‫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 going to go custom image.
‫Paths equals a little list comprehension again.
‫Plus F name, file name for f name in o's dot list.
‫Duh.
‫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.
‫Now, what was I saying?
‫This is, yeah, the gold standard of machine learning and deep learning is, is seeing how your model.
‫I can't even type right now.
‫Hmm.
‫Well, hasn't this work?
‫For s f name in.
‫Dog vision, custom path.
‫Plus if.
‫Name four.
‫If name and O's.
‫Why isn't this working?
‫Oh, do I have to rerun this?
‫Empty list.
‫Hmm.
‫Oh, stop, Lister.
‫Custom path.
‫Have I uploaded any dog photos there?
‫That is why it is not working.
‫Classic.
‫Let's upload my doggie photos.
‫Got distracted talking to excel at it.
‫Open that.
‫So this is going to upload shouldn't take too long because it's only three photos.
‫If you were using more data.
‫I'd 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.
‫We'll pass that there and then we'll check out custom data.
‫Or 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 to 4 by 2 to 4 by three in the form of two 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 Preds loaded full model.
‫Dot 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 array, 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 going to go get Pred label wonderful pass it custom Fred's.
‫Eye for eye in range, Len.
‫Custom parades.
‫Now, this is just a little comprehension to get the prediction label of the custom Fred eye for range
‫length custom parade.
‫So for each one, get the red label custom red labels.
‫Or we are kicking.
‫Have a go at this.
‫So now we need to get the custom images, a.k.a. un batch ify.
‫Oh no.
‫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 our own batch of 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 all we don't want to stop while we're hot.
‫We don't want to stop.
‫Dog vision is coming to life.
‫We're like mad scientists here hacking together.
‫We've gone home from the cafe so distraught that we've built an entire deep learning model to help us
‫figure out what dogs we're checking out for.
‫Image in custom data.
‫We just need to unpack 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 numpy iterator.
‫So custom images append image.
‫Does that make sense?
‫So we've got an empty list where on batching 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 sell, I reckon.
‫Check 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 refix 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, plot dot figure.
‫We're going to go fig size equals 1010.
‫And we're going to go for eye image in enumerate.
‫Custom images.
‫So if you're not sure of what enumerate 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 potty subplot.
‫I'm go 13i plus one.
‫Three columns one row.
‫And this is the index of our subplot.
‫That's why we get I don't want to go PLT on X ticks set that to non to get rid of that wackiness.
‫We just want to see see our pictures in their full light pelt why tex.
‫PLT.
‫Title Custom Pred labels.
‫I.
‫KLT Macho image.
‫So the title is just going to be the label that our model is predicted and the image should come up.
‫So are you ready?
‫Dog vision in the flesh.
‫Oh, how good is that?
‫So this is a picture of Baby Bella Lakeland Terrier.
‫I'm not actually sure what a Lakeland Terry is.
‫I think we have looked that one up.
‫Images.
‫Okay.
‫You can kind of see why it looks like that.
‫Because Bella in baby form is real fluffy around here.
‫And then that's 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've got to hear.
‫Now, I need you to do me a favor.
‫If you're in the Discord 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 right 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 these 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 multiclass image classifier using TensorFlow two and TensorFlow hub.
‫We defined our problem.
‫We defined our data from Kaggle.
‫We've defined our evaluation.
‫We've gone through a bunch of different features.
‫We've got our workspace ready using TensorFlow two and a GPU.
‫We've got our data ready, turning it into tenses.
‫We've seen how many different dog breed images there are.
‫We've got the images in 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 it 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 TensorFlow 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 trying 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 a look at.
‫And we've seen how to save and reload our trained models.
‫Oh.
‫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 modelling task.
‫You've gone through this steps, the TensorFlow 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 CPU, 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.