1
00:00:00,000 --> 00:00:01,830
The images in the horses are

2
00:00:01,830 --> 00:00:05,025
humans dataset are all
300 by 300 pixels.

3
00:00:05,025 --> 00:00:07,470
So we had quite a few
convolutional layers to

4
00:00:07,470 --> 00:00:10,275
reduce the images down
to condensed features.

5
00:00:10,275 --> 00:00:13,020
Now, this of course can
slow down the training.

6
00:00:13,020 --> 00:00:15,030
So let's take a look at
what would happen if

7
00:00:15,030 --> 00:00:16,800
we change it to a 150 by a

8
00:00:16,800 --> 00:00:19,260
150 for the images
to have a quarter of

9
00:00:19,260 --> 00:00:22,275
the overall data and to see
what the impact would be.

10
00:00:22,275 --> 00:00:24,630
We'll start as before by

11
00:00:24,630 --> 00:00:28,060
downloading and unzipping
the training and test sets.

12
00:00:29,180 --> 00:00:32,030
Then we'll point
some variables in the training

13
00:00:32,030 --> 00:00:34,480
and test sets before
setting up the model.

14
00:00:34,480 --> 00:00:36,725
First, we'll import TensorFlow

15
00:00:36,725 --> 00:00:38,990
and now we'll define
the layers for the model.

16
00:00:38,990 --> 00:00:42,770
Note that we've changed the
input shape to be 150 by 150,

17
00:00:42,770 --> 00:00:44,750
and we've removed
the fourth and fifth

18
00:00:44,750 --> 00:00:47,170
convolutional max
pool combinations.

19
00:00:47,170 --> 00:00:49,310
Our model summary
now shows the layer

20
00:00:49,310 --> 00:00:51,800
starting with the 148 by 148,

21
00:00:51,800 --> 00:00:54,680
that was the result of
convolving the 150 by 150.

22
00:00:54,680 --> 00:00:56,570
We'll see that at the end,

23
00:00:56,570 --> 00:00:58,520
we end up with a 17 by 17 by

24
00:00:58,520 --> 00:00:59,600
the time we're through all

25
00:00:59,600 --> 00:01:01,285
of the convolutions and pooling.

26
00:01:01,285 --> 00:01:03,720
We'll compile
our model as before,

27
00:01:03,720 --> 00:01:06,240
and we'll create
our generators as before,

28
00:01:06,240 --> 00:01:08,030
but note that the target size has

29
00:01:08,030 --> 00:01:10,950
now changed to 150 by 150.

30
00:01:12,260 --> 00:01:14,750
Now we can begin the training,

31
00:01:14,750 --> 00:01:15,910
and we can see that after

32
00:01:15,910 --> 00:01:18,505
the first epoch that
the training is fast,

33
00:01:18,505 --> 00:01:21,935
and accuracy and validation
aren't too bad either.

34
00:01:21,935 --> 00:01:24,000
The training continues and

35
00:01:24,000 --> 00:01:27,130
both accuracy values
will tick up.

36
00:01:33,170 --> 00:01:35,830
Often, you'll see accuracy values

37
00:01:35,830 --> 00:01:38,605
that are really high like 1.000,

38
00:01:38,605 --> 00:01:41,305
which is likely a sign
that you're overfitting.

39
00:01:41,305 --> 00:01:42,940
We reach the end, I have

40
00:01:42,940 --> 00:01:45,610
really high accuracy
on the test data,

41
00:01:45,610 --> 00:01:48,520
about 0.99, which
is much too high.

42
00:01:48,520 --> 00:01:51,010
The validation set is about 0.84,

43
00:01:51,010 --> 00:01:52,720
which is pretty good, but

44
00:01:52,720 --> 00:01:55,700
let's put it to the test
with some real images.

45
00:01:56,930 --> 00:02:00,345
Let's start with this image
of the girl and the horse.

46
00:02:00,345 --> 00:02:03,030
It still classifies as a horse.

47
00:02:03,030 --> 00:02:06,850
Next, let's take a look
at this cool horsey,

48
00:02:09,890 --> 00:02:14,570
and who's still
correctly categorized.

49
00:02:17,130 --> 00:02:22,040
These cuties are also
correctly categorized,

50
00:02:23,780 --> 00:02:27,810
but this one is still
wrongly categorized.

51
00:02:27,810 --> 00:02:30,790
But the most interesting
I think is this woman.

52
00:02:30,790 --> 00:02:34,900
When we use 300 by 300 before
and more convolutions,

53
00:02:34,900 --> 00:02:36,820
she was correctly classified.

54
00:02:36,820 --> 00:02:39,640
But now, she isn't.

55
00:02:39,830 --> 00:02:43,340
This is a great example
of the importance of

56
00:02:43,340 --> 00:02:44,855
measuring your training data

57
00:02:44,855 --> 00:02:47,330
against a large validation set,

58
00:02:47,330 --> 00:02:48,590
inspecting where it got it

59
00:02:48,590 --> 00:02:51,590
wrong and seeing what
you can do to fix it.

60
00:02:51,590 --> 00:02:54,725
Using this smaller set is
much cheaper to train,

61
00:02:54,725 --> 00:02:56,750
but then errors like
this woman with her back

62
00:02:56,750 --> 00:02:59,645
turned and her legs obscured
by the dress will happen,

63
00:02:59,645 --> 00:03:02,695
because we don't have
that data in the training set.

64
00:03:02,695 --> 00:03:04,790
That's a nice hint about how to

65
00:03:04,790 --> 00:03:08,430
edit your dataset for
the best effect in training.