1
00:00:00,300 --> 00:00:06,120
Hi and welcome back in this lesson, we'll take a look at implementing the same rank one rank five accuracy

2
00:00:06,120 --> 00:00:10,810
metric using carrots, so open that notebook and we'll get started.

3
00:00:10,810 --> 00:00:16,190
If so, then that's what we're going to test in is to mobile on that level at V2.

4
00:00:16,200 --> 00:00:19,780
So let's look at this network, and there we go.

5
00:00:19,860 --> 00:00:23,310
So we've loaded the network we see it's 3.5 million parameters.

6
00:00:23,730 --> 00:00:24,540
Not too big.

7
00:00:24,540 --> 00:00:26,880
Not, but actually it's pretty small, to be fair.

8
00:00:27,660 --> 00:00:30,800
Now let's download our image, net classes and our images.

9
00:00:30,810 --> 00:00:31,860
Actually, we don't need the image.

10
00:00:31,860 --> 00:00:35,490
No classes with two cameras, so this code is minus redundant.

11
00:00:36,120 --> 00:00:37,950
And let's just get images here.

12
00:00:39,840 --> 00:00:44,010
So I've actually downloaded these images previously, even just testing this notebook beforehand.

13
00:00:44,010 --> 00:00:48,840
So I need to rewrite and overwrite all of his images.

14
00:00:49,440 --> 00:00:51,690
So those images are stored in the directory.

15
00:00:51,690 --> 00:00:53,870
You've seen the full images class one.

16
00:00:53,880 --> 00:00:59,730
All of the images are here, so let's just get the file names out of it now because we're going to look

17
00:00:59,730 --> 00:01:00,720
through all of those.

18
00:01:01,320 --> 00:01:02,520
So what do we do here?

19
00:01:02,550 --> 00:01:04,770
I don't make it function like I didn't fight too much.

20
00:01:04,770 --> 00:01:08,250
Maybe I was a bit lazy when I was making this example code here.

21
00:01:08,730 --> 00:01:10,350
But anyway, it's fine.

22
00:01:10,560 --> 00:01:12,690
It's this experimental teaching code.

23
00:01:13,350 --> 00:01:18,930
So what we do here, we're just looking through the file names here and then inputting them into the

24
00:01:19,200 --> 00:01:22,770
a smaller model, which is the mobile net model that we created.

25
00:01:23,430 --> 00:01:31,650
And we just create this this this open TV version of the image to display when you want to display it.

26
00:01:32,610 --> 00:01:33,940
We get a model actually visited.

27
00:01:33,990 --> 00:01:35,370
The Zespri possesses it here.

28
00:01:35,380 --> 00:01:36,920
Then here's where we pass it.

29
00:01:36,930 --> 00:01:43,680
Through the model, we use the decode predictions function that is specific to the mobile net class,

30
00:01:43,680 --> 00:01:45,790
which you can see up here.

31
00:01:45,810 --> 00:01:51,000
It's just double check that if it is specific to the mobile on the School V2 network.

32
00:01:51,690 --> 00:01:55,890
So we have secret predictions and pre-processing function that's specific to that network.

33
00:01:56,580 --> 00:01:58,580
Let's go back to it here.

34
00:01:58,590 --> 00:02:02,340
So we decode the predictions stored in subclasses that we get.

35
00:02:02,910 --> 00:02:04,890
We can setup equal five.

36
00:02:05,070 --> 00:02:09,990
So that's similar to the function we use and play touch so we can set this to anything we want.

37
00:02:10,620 --> 00:02:15,120
So if you want to get to the top, end or top, whatever, you just change this variable here.

38
00:02:15,720 --> 00:02:21,120
So this is just giving us now the predictions and the top story, the top predictions for each of the

39
00:02:21,120 --> 00:02:21,600
classes.

40
00:02:21,600 --> 00:02:23,940
So let's run this and I'll show you the output.

41
00:02:27,580 --> 00:02:28,250
So there we go.

42
00:02:28,270 --> 00:02:34,660
So you can see for the basketball image, it returns an area that looks like this, so we have the tuple

43
00:02:34,660 --> 00:02:40,060
and the fist as a fist in the first index slot of this array.

44
00:02:40,930 --> 00:02:47,540
So it has the it has basically a number of specific to that which we wouldn't use its numbers.

45
00:02:47,650 --> 00:02:52,720
This number is specific to the iteration of that prediction.

46
00:02:53,080 --> 00:02:54,850
So ignore it for now.

47
00:02:55,390 --> 00:02:58,000
Then we have basketball as a class and the Pro Bowl.

48
00:02:58,000 --> 00:02:59,780
Two percent ninety nine point nine.

49
00:02:59,890 --> 00:03:00,580
Very good.

50
00:03:01,030 --> 00:03:03,250
Then we have rugby board very little percent.

51
00:03:03,250 --> 00:03:05,970
Croquet will very, very little percent and so on.

52
00:03:05,970 --> 00:03:08,110
And imagine all year the classes are super low.

53
00:03:08,110 --> 00:03:11,560
It's very confident that this is a basketball that's good to know.

54
00:03:12,280 --> 00:03:13,990
Now you can see it's for German Shepherd.

55
00:03:13,990 --> 00:03:15,550
Ninety five percent limousine.

56
00:03:15,550 --> 00:03:18,790
Ninety six percent spiderweb a bit less sure.

57
00:03:18,880 --> 00:03:26,530
At 77 percent, pretty sure it's a burrito now that gives a lot of buzz buzz as the top class for this.

58
00:03:26,530 --> 00:03:30,290
However, you do see Big Glass as one of the top five.

59
00:03:30,370 --> 00:03:31,210
That's quite good.

60
00:03:32,020 --> 00:03:32,620
That's one of the things.

61
00:03:32,620 --> 00:03:36,340
It's a wallet miracle because of the shape, but it's a really a doormat.

62
00:03:37,400 --> 00:03:43,150
Christmas stocking was 81 percent quite good and Collie was in eight percent, which is actually very

63
00:03:43,150 --> 00:03:43,390
good.

64
00:03:43,990 --> 00:03:47,050
So that's how we get the top classes out of that.

65
00:03:47,530 --> 00:03:51,940
So you can see by looking at that predictions variable, these are the outputs here, which we just

66
00:03:51,940 --> 00:03:55,360
display at the title of the subplot here.

67
00:03:55,360 --> 00:04:01,210
We're just getting the top one out of the deal and we can see all the top classes, which is the top

68
00:04:01,210 --> 00:04:02,940
five for each one is stored here.

69
00:04:02,950 --> 00:04:07,120
So we have Rambouillet returns five answers for each image.

70
00:04:07,570 --> 00:04:13,420
These are the five answers here, so it's a bit messy in the display, but this is a test German shepherd

71
00:04:13,420 --> 00:04:14,020
limousine.

72
00:04:14,380 --> 00:04:17,340
Some are printed in multiple and some of them seem lame.

73
00:04:17,950 --> 00:04:23,770
So hopefully you understand what this is and know we have a growing with labels which we set here,

74
00:04:24,730 --> 00:04:31,690
and then we create our own get school function where we use in here to get the number of classes in

75
00:04:31,690 --> 00:04:32,140
the label.

76
00:04:32,200 --> 00:04:41,710
So let's run this and what we'll do, actually, because I should have warned you earlier, but for

77
00:04:41,710 --> 00:04:46,090
now, what we because we're using the predictions out of this here.

78
00:04:46,630 --> 00:04:48,040
Let's set this to 10.

79
00:04:49,210 --> 00:04:56,560
So we always have 10 top 10 predictions for each image in January, and that's why it becomes much smaller.

80
00:04:56,560 --> 00:04:57,820
So apologies for that.

81
00:04:58,420 --> 00:05:04,120
But now you can see this remains the same, but this now will get a lot bigger because as we're seeing

82
00:05:04,120 --> 00:05:09,640
all the top 10 results for each image, and the reason why I do that for is because this get school

83
00:05:09,640 --> 00:05:18,040
function, it uses that all top class as variable as as input here and we just set in here in this function.

84
00:05:18,040 --> 00:05:23,890
But this function does not control the number of classes, but that was done in the loop with the Keros

85
00:05:23,890 --> 00:05:24,820
top function.

86
00:05:25,540 --> 00:05:31,210
So let's get the top five ranked five accuracy, which we saw was 7.7 percent, which is OK.

87
00:05:31,420 --> 00:05:38,510
It's not about from mobile that Iraq won accuracy is pretty bad to its 55 percent accuracy, and now

88
00:05:38,530 --> 00:05:43,300
we can see the rank and accuracy also at seventy seven point eight percent.

89
00:05:43,900 --> 00:05:44,760
So that's not bad.

90
00:05:44,770 --> 00:05:48,610
Overall, it's not great, but that's how we're rank top five.

91
00:05:48,610 --> 00:05:55,180
What rank and accuracy using us if you wanted to use this on your own but never works?

92
00:05:55,630 --> 00:05:56,650
Take a look at the code.

93
00:05:56,650 --> 00:06:00,910
Take a look at the building blocks of this code, and you can easily just recreate it for your own network.

94
00:06:01,450 --> 00:06:02,650
So I'll stop there.

95
00:06:02,650 --> 00:06:07,390
And now we'll move on to where you're going to train, whether cats with dogs.

96
00:06:08,140 --> 00:06:08,770
Listen here.

97
00:06:09,250 --> 00:06:14,770
And the point of this lesson is to show you how you can actually train on your own data sets, as opposed

98
00:06:14,770 --> 00:06:21,020
to the loading datasets from the functions and carers and page, which we're now going to download or

99
00:06:21,070 --> 00:06:23,770
data said and trained on our own images.

100
00:06:24,190 --> 00:06:29,680
So it's a good lesson for you guys to start learning with and also with the carers lesson, and we will

101
00:06:29,680 --> 00:06:31,270
introduce callbacks as well.

102
00:06:31,450 --> 00:06:32,870
So I'll see you in that lesson.

103
00:06:32,890 --> 00:06:33,340
Thank you.
