1
00:00:00,630 --> 00:00:01,410
All righty.

2
00:00:01,420 --> 00:00:06,580
The most exciting part of dog vision the reason why we built this in the first place it's so when I'm

3
00:00:06,850 --> 00:00:10,840
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

4
00:00:10,840 --> 00:00:14,390
back here and you want to check what breed of dog that was.

5
00:00:14,530 --> 00:00:15,600
You can.

6
00:00:15,730 --> 00:00:21,220
So let's make a little section making predictions on custom images.

7
00:00:21,220 --> 00:00:28,270
And this is just another version of processing our inputs passing them to our machine learning algorithm

8
00:00:28,600 --> 00:00:33,550
and then verifying our outputs when we're first starting with machine learning we were first starting

9
00:00:33,550 --> 00:00:34,480
with deep learning.

10
00:00:34,510 --> 00:00:41,090
This is what we're focused on what are our inputs what are our outputs how can we use an existing machine

11
00:00:41,090 --> 00:00:44,650
learning algorithm which we already have to figure these two out.

12
00:00:44,870 --> 00:00:48,530
So let's go here and what do we need to do.

13
00:00:48,710 --> 00:00:59,050
So to make predictions on custom images well actually let me just show you the custom images first so

14
00:00:59,350 --> 00:01:03,890
I've got three dog photos here.

15
00:01:03,890 --> 00:01:04,760
There's my Poppy.

16
00:01:04,820 --> 00:01:09,320
We've seen that one before that seven Bell is actually in the background might confuse our model a little

17
00:01:09,320 --> 00:01:10,290
bit.

18
00:01:10,370 --> 00:01:13,860
There's another photo of baby Bello and she was so small.

19
00:01:13,880 --> 00:01:19,070
She's a lot bigger than that now and there's a recent photo of Bella sitting on one of our couches just

20
00:01:19,070 --> 00:01:23,450
chilling out staring at the camera with those big brown eyes.

21
00:01:23,650 --> 00:01:29,530
This is a beautiful thing about working on a deep learning project that works with dogs to look at photos

22
00:01:29,530 --> 00:01:32,330
of dogs so get the file parts.

23
00:01:32,350 --> 00:01:39,990
We need to get the file parts of our own images are actually my photos are currently stored locally.

24
00:01:40,000 --> 00:01:41,780
So we might need to upload them here.

25
00:01:41,800 --> 00:01:46,750
Actually what I'm going to do is create a new folder while I'm uploading these images I want you to

26
00:01:46,750 --> 00:01:50,860
think about what do we have to do to the inputs of our machine learning model

27
00:01:55,820 --> 00:01:59,140
dog photos.

28
00:01:59,210 --> 00:02:02,090
What's the most important thing when we're preparing our inputs

29
00:02:04,900 --> 00:02:07,540
Well if you said we have to convert them to numbers you be correct.

30
00:02:07,540 --> 00:02:13,270
And if you said we have to convert them into the same type of data that how machine learning model was

31
00:02:13,270 --> 00:02:21,460
trained on you'd also be correct turn the file parts into data batches using create.

32
00:02:21,490 --> 00:02:24,030
This is where our function is coming back into play.

33
00:02:24,040 --> 00:02:25,540
Create data batches.

34
00:02:25,600 --> 00:02:26,280
Yes.

35
00:02:26,290 --> 00:02:32,450
And since our custom images won't have labels because that's what we're trying to find out.

36
00:02:32,800 --> 00:02:48,030
We set the test data parameter to true and then we pass the customer image data back to our models predict

37
00:02:49,670 --> 00:03:01,090
method and then we have to convert the prediction output probabilities to prediction labels.

38
00:03:01,120 --> 00:03:08,620
So making them in something that we can understand and then compare the predicted labels to the custom

39
00:03:08,740 --> 00:03:10,570
images.

40
00:03:10,840 --> 00:03:13,510
That's a bit of a challenge but it's nothing that we've seen before.

41
00:03:13,540 --> 00:03:15,590
Looks like a lot but we're going to take it down.

42
00:03:16,060 --> 00:03:20,610
So let's get the custom image file parts.

43
00:03:20,710 --> 00:03:24,910
We'll set up the custom path and we just did that.

44
00:03:24,940 --> 00:03:36,530
So that's gonna be drive slash my drive slash dog vision slash chores at my dog photos.

45
00:03:36,610 --> 00:03:41,830
That's where I just uploaded three of my own dog photos so you might want to upload your own dog photos

46
00:03:41,830 --> 00:03:43,610
to here if you have some.

47
00:03:43,750 --> 00:03:47,010
I hope you do and then we go here.

48
00:03:47,020 --> 00:03:54,340
We're gonna get a custom image paths Eagles a little less comprehension again.

49
00:03:55,800 --> 00:04:00,460
Plus f name file name for F name in ours.

50
00:04:00,480 --> 00:04:01,800
Don't list.

51
00:04:02,820 --> 00:04:07,330
So this is like the gold standard of what you're doing with your machine learning model.

52
00:04:07,380 --> 00:04:11,520
Once you've trained it it's one thing to use it on data you've been provided.

53
00:04:11,820 --> 00:04:16,310
But what we're doing now is using it on our own custom data.

54
00:04:16,480 --> 00:04:18,680
Oh no.

55
00:04:18,830 --> 00:04:19,740
There we go.

56
00:04:21,100 --> 00:04:24,110
So we should have some custom image paths.

57
00:04:24,130 --> 00:04:24,730
What was I saying.

58
00:04:24,730 --> 00:04:31,120
This is yet a gold standard of machine learning and deep learning as is seeing how your model.

59
00:04:31,290 --> 00:04:32,680
I can't even type right now.

60
00:04:36,840 --> 00:04:43,720
Why hasn't this work for S F name in Dawg vision.

61
00:04:43,730 --> 00:04:51,290
Custom path plus f name for F name in OS Y is in this work.

62
00:04:51,810 --> 00:04:52,920
Oh do I have to rerun this

63
00:04:56,010 --> 00:04:57,240
empty list.

64
00:04:57,260 --> 00:04:57,650
Mm hmm.

65
00:04:59,220 --> 00:05:00,500
Always do list.

66
00:05:03,680 --> 00:05:06,890
Custom path.

67
00:05:07,040 --> 00:05:10,090
Have I not uploaded any dog photos there.

68
00:05:10,100 --> 00:05:13,150
That is why it is not working.

69
00:05:13,220 --> 00:05:14,600
Classic.

70
00:05:14,780 --> 00:05:17,400
Let's upload my doggy photos.

71
00:05:17,490 --> 00:05:19,560
Got distracted talking too excited.

72
00:05:20,440 --> 00:05:27,420
Open that so this is gonna upload shouldn't take too long because it's only three photos.

73
00:05:27,420 --> 00:05:30,540
If you're using more data I'll probably find a different way.

74
00:05:32,180 --> 00:05:33,130
There we go.

75
00:05:35,890 --> 00:05:37,580
Now we'll come back here.

76
00:05:37,690 --> 00:05:42,500
This should work fingers crossed and it does.

77
00:05:42,750 --> 00:05:45,630
Now what do we have to do.

78
00:05:45,640 --> 00:05:48,610
Well we need to create data batches.

79
00:05:48,610 --> 00:05:50,390
So this is what we can do.

80
00:05:50,500 --> 00:06:03,480
Turn custom images into batch data set so we'll go custom data equals create data batches.

81
00:06:03,480 --> 00:06:11,610
This is our trusty little function that we've written many moons ago but as I said it's going to come

82
00:06:11,610 --> 00:06:12,830
in handy one day.

83
00:06:12,900 --> 00:06:17,880
Custom Image paths will pass that there and then we'll check out custom data.

84
00:06:17,980 --> 00:06:25,450
All remember because this has no labels we need to pass it in as if it's test data.

85
00:06:25,570 --> 00:06:27,080
There we go.

86
00:06:27,220 --> 00:06:29,920
Batch data set of the shapes.

87
00:06:29,920 --> 00:06:30,410
There we go.

88
00:06:30,400 --> 00:06:35,000
Images 2 2 4 by 2 2 4 by 3 in the form of T F floats.

89
00:06:35,050 --> 00:06:44,200
Our custom images are in tenses so we can make predictions on the custom data.

90
00:06:44,200 --> 00:06:49,440
How do we make a prediction with our model custom spreads loaded.

91
00:06:49,780 --> 00:06:57,340
Full model don't predict custom data.

92
00:06:58,000 --> 00:06:59,350
Yes please.

93
00:06:59,680 --> 00:07:02,110
We'll have a look at custom threads.

94
00:07:02,110 --> 00:07:05,860
Can you guess what shape this will be.

95
00:07:05,910 --> 00:07:07,680
We've seen that before.

96
00:07:09,330 --> 00:07:10,370
We're getting hot.

97
00:07:10,610 --> 00:07:11,530
We're getting hot in here.

98
00:07:13,330 --> 00:07:15,400
Custom threads yes three images.

99
00:07:15,400 --> 00:07:18,890
So we've got 120 prediction probabilities for each one.

100
00:07:19,030 --> 00:07:20,440
And now what do we have to do.

101
00:07:20,440 --> 00:07:22,170
So now we've got a prediction of right.

102
00:07:22,300 --> 00:07:28,240
Let's convert them into labels and then compare the labels with each image.

103
00:07:28,240 --> 00:07:39,090
So get custom image prediction labels and we're going to go custom pred labels equals we're gonna go

104
00:07:39,090 --> 00:07:42,480
get Fred label.

105
00:07:42,720 --> 00:07:43,430
Wonderful.

106
00:07:43,440 --> 00:07:50,670
Pass it custom Fred's eye for I in range.

107
00:07:50,690 --> 00:07:54,470
Len custom parades.

108
00:07:54,470 --> 00:08:00,830
Now this is just a little comprehension to get the prediction label of the custom pred eye for range

109
00:08:00,890 --> 00:08:02,810
length custom parade.

110
00:08:02,810 --> 00:08:12,100
So for each one get the Red Label custom Fred labels all we are kickin have a go at this.

111
00:08:12,110 --> 00:08:18,070
So now we need to get the custom images a.k.a. UNbacked Wi-Fi on our own batch of five.

112
00:08:18,070 --> 00:08:20,390
Function won't work since we don't have any labels.

113
00:08:20,390 --> 00:08:26,060
That's one little tidbit that we could probably improve out on batch ify function later on but for now

114
00:08:26,990 --> 00:08:37,600
we will get the custom images out on batch ify function won't work since there aren't labels.

115
00:08:37,880 --> 00:08:42,770
Maybe we could fix this later because we're on a roll.

116
00:08:42,770 --> 00:08:44,140
We don't want to start while we're hot.

117
00:08:44,150 --> 00:08:46,960
We don't want to stop dog vision is coming to life.

118
00:08:46,970 --> 00:08:52,820
We'd like mad scientist here hacking together we've gone home from the cafe so distraught that we've

119
00:08:52,820 --> 00:08:59,870
built an entire day learning model to help us figure out what dogs were checking out for image and custom

120
00:08:59,870 --> 00:09:00,230
data.

121
00:09:00,230 --> 00:09:03,920
We just need to um batch it so we'll go on batch.

122
00:09:03,960 --> 00:09:13,100
So remember this is going to unwind our data batch into just images and into something that we can iterate

123
00:09:13,160 --> 00:09:17,360
over because we're using as Num pi iterator.

124
00:09:17,360 --> 00:09:25,620
So custom images dot append image does that make sense so we've got an empty list.

125
00:09:25,630 --> 00:09:28,540
We're unpacking our batch custom data set.

126
00:09:28,570 --> 00:09:33,400
We're turning it into an iterator and we're appending each image to custom images.

127
00:09:35,140 --> 00:09:41,410
Shifted into one last cell I reckon checked Custom Image predictions.

128
00:09:41,410 --> 00:09:42,500
Now we want to plot it up.

129
00:09:42,520 --> 00:09:44,960
We want to plot it up like we've done before.

130
00:09:45,190 --> 00:09:45,900
Right up here.

131
00:09:45,910 --> 00:09:49,930
But because we don't have labels we can't really use our function up here.

132
00:09:49,960 --> 00:09:51,270
That's a bit of a booboo.

133
00:09:51,300 --> 00:09:56,920
So we might have to re fix this function at a later date as well that might be a little challenge for

134
00:09:56,920 --> 00:09:58,190
yourself.

135
00:09:58,210 --> 00:10:00,640
Now we go right back down to where we were.

136
00:10:00,880 --> 00:10:02,810
Check custom predictions.

137
00:10:02,880 --> 00:10:14,960
I'll tell you that figure we're going to go figure size equals 10 10 and we go for I image in enumerate

138
00:10:16,370 --> 00:10:20,370
custom images.

139
00:10:20,630 --> 00:10:25,610
So if you're not sure of what a numerator is it's just going to go for the images in custom images count

140
00:10:25,610 --> 00:10:32,900
them up save the count of it to I and save the image inside custom images to image and we're going to

141
00:10:32,900 --> 00:10:46,030
go APL a dot subplot 1 3 I plus 1 three columns one row and this is the index of our subplot that's

142
00:10:46,030 --> 00:10:52,780
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

143
00:10:52,780 --> 00:11:07,730
to see see how pitches in their full light belted out y takes peyote a title custom Fred labels I peyote

144
00:11:07,870 --> 00:11:10,840
don't aim show image.

145
00:11:11,060 --> 00:11:16,000
So the title is just gonna be the label that our model has predicted and image should come up.

146
00:11:16,820 --> 00:11:18,460
So are you ready.

147
00:11:18,590 --> 00:11:20,930
Dog vision in the flesh.

148
00:11:21,170 --> 00:11:24,580
Oh how good is that.

149
00:11:24,620 --> 00:11:27,460
So this is the picture of baby Bella Lakeland.

150
00:11:27,470 --> 00:11:32,980
Terry I'm not actually sure what a like land Terry is I think we have look that one up images

151
00:11:35,830 --> 00:11:44,540
OK you can kind of see why it looks like that because Bella in baby form is real fluffy around here

152
00:11:45,020 --> 00:11:51,110
and then that seven golden retriever which is exactly right what she is and Bella is a Labrador Labrador

153
00:11:51,110 --> 00:11:58,760
retriever that is phenomenal so dog vision has fully come to life you should be ecstatic with yourself

154
00:11:58,790 --> 00:11:59,920
if you got to here.

155
00:12:00,050 --> 00:12:06,200
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

156
00:12:06,200 --> 00:12:12,440
made some predictions on your own custom images with your dogs please share them I want to see your

157
00:12:12,440 --> 00:12:17,840
dogs and what our model that we've built has predicted for them and is it ride or is it wrong maybe

158
00:12:17,840 --> 00:12:22,340
you could add that to this functionality you could make the name because you know the true labels of

159
00:12:22,340 --> 00:12:24,030
your own dogs or maybe you don't.

160
00:12:24,080 --> 00:12:27,830
So maybe you're trying to figure it out that's the purpose of dog vision.

161
00:12:28,010 --> 00:12:30,710
That was our end goal right from the beginning.

162
00:12:30,920 --> 00:12:37,510
So if we come here we've gone look at all this headings you should be so proud if you've made it all

163
00:12:37,510 --> 00:12:40,970
the way through here we've gone from right up the top.

164
00:12:41,280 --> 00:12:45,460
This notebook builds an end to end multi class image classifier using tensor flow to intensive flow

165
00:12:45,460 --> 00:12:52,720
hub we defined our problem we defined our data from Kaggle we have defined our valuation we've gone

166
00:12:52,720 --> 00:12:57,340
through a bunch of different features we've got our workspace ready using tensor flow to energy you

167
00:12:57,640 --> 00:13:02,950
we've got our data ready turning it into tenses we've seen how many different dog breed images there

168
00:13:02,950 --> 00:13:10,580
are you've got the images and the labels my goodness how much have we covered go back through all of

169
00:13:10,580 --> 00:13:17,360
this and give yourself a pat on the back and if it all doesn't make sense don't worry if you've gone

170
00:13:17,360 --> 00:13:23,000
through for the first time it's not going to but what this is it's a momentum builder Let's go right

171
00:13:23,000 --> 00:13:27,140
down to the bottom what we've done we've gone through we've got our data ready we turn it into tenses

172
00:13:27,200 --> 00:13:32,180
we've picked a model to suit our problem image classification using tensor flow hub a.k.a. a neural

173
00:13:32,180 --> 00:13:38,780
network a deep learning neural network we fit the model to the data we've made predictions we've evaluated

174
00:13:38,780 --> 00:13:43,850
our model by visualizing our predictions we've improved through experimentation by trialling out a model

175
00:13:43,850 --> 00:13:49,340
to make sure that it works on a thousand images first before scaling up of course there are some more

176
00:13:49,340 --> 00:13:54,440
improvements that we can do I'll leave that some extensions in a lecture after this one that you can

177
00:13:54,440 --> 00:14:03,370
have look at and we've seen how to save and reload our trained models that is phenomenal you've made

178
00:14:03,370 --> 00:14:08,200
it through holy goodness I am so stoked for you.

179
00:14:08,200 --> 00:14:15,820
The important thing is to remember that this is a momentum builder you've now gone through a full blown

180
00:14:15,910 --> 00:14:23,410
end to end machine learning modeling task you've gone through these steps a tenser flow workflow so

181
00:14:23,410 --> 00:14:30,490
now you can adapt the principles that you've learned all throughout this notebook on different problems

182
00:14:30,490 --> 00:14:36,190
you can go Hey I know if I'm working on a different problem I might not know exactly how to solve it

183
00:14:36,220 --> 00:14:40,550
but I've got evidence that I have actually been.

184
00:14:40,570 --> 00:14:46,360
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

185
00:14:46,690 --> 00:14:52,330
I've tried to model on a GP you I've made predictions on test data and then I've made even predictions

186
00:14:52,360 --> 00:15:00,100
on my own custom data you should be stoked with yourself so please share your predictions on your custom

187
00:15:00,100 --> 00:15:05,770
dog images if you have them I would love to see them make sure you tag me in the discord but otherwise

188
00:15:06,040 --> 00:15:11,740
I will see you in the next video and I'll leave some extensions for this project as well as different

189
00:15:11,740 --> 00:15:14,350
resources in the next lecture that you can check out.
