1
00:00:00,000 --> 00:00:01,500
Now, this is a new data set that

2
00:00:01,500 --> 00:00:03,090
I created for learning
opportunities.

3
00:00:03,090 --> 00:00:04,740
It's freely available, and it

4
00:00:04,740 --> 00:00:07,545
consists of about 3,000 images.

5
00:00:07,545 --> 00:00:09,210
They've all been generated using

6
00:00:09,210 --> 00:00:11,640
CGI with a diverse
array of models,

7
00:00:11,640 --> 00:00:14,325
male and female, and lots
of different skin tones,

8
00:00:14,325 --> 00:00:15,990
and here's some examples.

9
00:00:15,990 --> 00:00:17,930
If you want to download
the data sets,

10
00:00:17,930 --> 00:00:19,815
you can find them at this URL.

11
00:00:19,815 --> 00:00:22,875
It will contain a training
set, a validation set,

12
00:00:22,875 --> 00:00:24,510
and some extra images
that you can

13
00:00:24,510 --> 00:00:26,955
download to test
the network for yourself.

14
00:00:26,955 --> 00:00:29,310
Once your directory is set up,

15
00:00:29,310 --> 00:00:31,440
you need to set up
your image generator.

16
00:00:31,440 --> 00:00:33,900
Here's the code that
you used earlier but,

17
00:00:33,900 --> 00:00:36,510
note the class mode
was set to binary.

18
00:00:36,510 --> 00:00:38,670
For multiple classes,
you'll have to

19
00:00:38,670 --> 00:00:41,725
change this to
categorical like this.

20
00:00:41,725 --> 00:00:43,610
The next change comes in

21
00:00:43,610 --> 00:00:45,470
your model definition where

22
00:00:45,470 --> 00:00:47,780
you'll need to change
the output layer.

23
00:00:47,780 --> 00:00:49,250
For a binary classifier,

24
00:00:49,250 --> 00:00:51,080
it was more efficient
for you to just have

25
00:00:51,080 --> 00:00:54,455
one neuron and use a sigmoid
function to activate it.

26
00:00:54,455 --> 00:00:56,240
This meant that it
would output close to

27
00:00:56,240 --> 00:00:58,865
zero for one class and
close to one for the other.

28
00:00:58,865 --> 00:01:01,010
Now, that doesn't
fit for multi-class,

29
00:01:01,010 --> 00:01:03,315
so we need to change it,
but it's pretty simple.

30
00:01:03,315 --> 00:01:06,050
Now, we have an output layer
that has three neurons,

31
00:01:06,050 --> 00:01:07,730
one for each of
the classes rock, paper,

32
00:01:07,730 --> 00:01:09,770
and scissors, and
it's activated by

33
00:01:09,770 --> 00:01:11,960
softmax which turns
all the values

34
00:01:11,960 --> 00:01:14,180
into probabilities that
will sum up to one.

35
00:01:14,180 --> 00:01:16,280
So what does that really mean?

36
00:01:16,280 --> 00:01:17,960
Consider a hand like this one.

37
00:01:17,960 --> 00:01:19,610
It's most likely a paper,

38
00:01:19,610 --> 00:01:22,670
but because she has
her first two fingers open,

39
00:01:22,670 --> 00:01:23,945
and the rest joined,

40
00:01:23,945 --> 00:01:26,240
it could also be
mistaken as scissors.

41
00:01:26,240 --> 00:01:28,460
The output of
a neural network with

42
00:01:28,460 --> 00:01:31,460
three neurons and a softmax
would reflect that,

43
00:01:31,460 --> 00:01:33,200
and maybe look like this

44
00:01:33,200 --> 00:01:35,285
with a very low
probability of rock,

45
00:01:35,285 --> 00:01:36,785
a really high one for paper,

46
00:01:36,785 --> 00:01:38,465
and a decent one for scissors.

47
00:01:38,465 --> 00:01:41,380
All three probabilities
would still add up to one.

48
00:01:41,380 --> 00:01:43,460
The final change then comes

49
00:01:43,460 --> 00:01:45,275
when you compile your network.

50
00:01:45,275 --> 00:01:47,645
If you recall with
the earlier examples,

51
00:01:47,645 --> 00:01:50,390
your loss function was
binary cross entropy.

52
00:01:50,390 --> 00:01:51,800
Now, you'll change it's

53
00:01:51,800 --> 00:01:54,740
a categorical cross
entropy like this.

54
00:01:54,740 --> 00:01:57,455
There are other
categorical loss functions

55
00:01:57,455 --> 00:01:59,270
including sparse categorical,

56
00:01:59,270 --> 00:02:02,210
cross entropy that you used
in the fashion example,

57
00:02:02,210 --> 00:02:04,970
and you can of course
also use those.

58
00:02:04,970 --> 00:02:06,875
Around this for 100 epochs,

59
00:02:06,875 --> 00:02:08,440
and I got this chart,

60
00:02:08,440 --> 00:02:12,395
it shows the training hits
a max at about 25 epochs.

61
00:02:12,395 --> 00:02:14,555
So I'd recommend
just using not many,

62
00:02:14,555 --> 00:02:16,430
and that's all really
that you have to do.

63
00:02:16,430 --> 00:02:19,290
So let's take a look
at it in the workbook.