Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,480 --> 00:00:07,560
Hello and welcome to this new tutorial in the previous oil we define the architecture of our discriminator.
2
00:00:07,560 --> 00:00:11,320
So now we are one step left to get our second brain.
3
00:00:11,400 --> 00:00:17,070
Before that we need to make the forward function we're going to make a new form function this time for
4
00:00:17,070 --> 00:00:19,140
the brain of the discriminator.
5
00:00:19,230 --> 00:00:25,070
This is going to be almost the same as the forward function we made for the generator.
6
00:00:25,200 --> 00:00:27,630
But there is going to be a slight difference.
7
00:00:27,810 --> 00:00:30,400
A slight trick not to forget to apply.
8
00:00:30,480 --> 00:00:32,300
We'll see that in this tutorial.
9
00:00:32,310 --> 00:00:38,220
All right so let's define a new function that we're going to call again forward.
10
00:00:38,280 --> 00:00:42,360
There is no danger to call it again forward.
11
00:00:42,660 --> 00:00:49,040
And this word function is going to take two arguments the same as before self to refer to the object.
12
00:00:49,050 --> 00:00:54,720
And because we're going to use the metal module main to form propagate the signal inside the neural
13
00:00:54,720 --> 00:01:02,020
network and the second argument is going to be the input of the discriminator neural network.
14
00:01:02,190 --> 00:01:08,790
So keep in mind and keep it well understood the input of the neural network of the discriminator is
15
00:01:08,790 --> 00:01:13,720
an image that is going to be one of the images created by the generator.
16
00:01:14,040 --> 00:01:19,320
All right so an input of three dimensions corresponding to the three channels.
17
00:01:19,560 --> 00:01:25,470
And let's also keep in mind that the output of the discriminator and therefore of this forward function
18
00:01:25,800 --> 00:01:32,910
is a discriminating number is going to be of value between 0 and 1 and that will do the discrimination
19
00:01:33,120 --> 00:01:39,030
according to which a number close to zero will reject the image and the number close to one will accept
20
00:01:39,180 --> 00:01:40,080
the image.
21
00:01:40,080 --> 00:01:41,480
So let's recap.
22
00:01:41,490 --> 00:01:47,300
The process is actually very easy to understand for discriminator the discriminator takes as inputs
23
00:01:47,610 --> 00:01:50,060
an image created by the generator.
24
00:01:50,220 --> 00:01:56,910
And for this image it will decide if it wants to accepted or rejected and to make that decision it will
25
00:01:56,910 --> 00:01:58,560
return the output.
26
00:01:58,560 --> 00:02:01,250
That is the discriminating number between 0 and 1.
27
00:02:01,320 --> 00:02:07,110
And if this output is close to zero it will reject it and if it is close to 1 it will accept it.
28
00:02:07,110 --> 00:02:13,490
So that's why in some way the discriminator is discriminating the creations of the generator.
29
00:02:13,560 --> 00:02:20,000
And so now we perfectly understand the name of what we're implementing the generative adversarial networks.
30
00:02:20,010 --> 00:02:26,750
Well that name is perfectly chosen because the discriminator is an adversary of the generator.
31
00:02:26,820 --> 00:02:33,030
It is like some kind of an adversary judge judging the creations of the generator judging whether they
32
00:02:33,030 --> 00:02:35,490
should be accepted or not.
33
00:02:35,490 --> 00:02:40,110
All right so now we understand clearly what's the input and what's the output.
34
00:02:40,110 --> 00:02:43,870
Let's go inside the function and let's define what we wanted to do.
35
00:02:44,040 --> 00:02:51,270
So the first thing that we need to do is get the output right the output that is returned by the main
36
00:02:51,330 --> 00:02:56,130
METAR module of our object which is referred by self.
37
00:02:56,130 --> 00:03:02,820
So I'm taking my objects self and then I'm taking the main metal module inside which of course I have
38
00:03:02,820 --> 00:03:05,340
to input Well the.
39
00:03:05,660 --> 00:03:09,990
All right the input image and image created by the generator.
40
00:03:10,400 --> 00:03:17,580
So that returns the output and in the end of course we must not forget to return the output because
41
00:03:17,580 --> 00:03:20,230
that's exactly the role of the forward function.
42
00:03:20,310 --> 00:03:26,760
Not only it propagates the signal inside the neural network but also and mostly it returns the output
43
00:03:26,930 --> 00:03:29,990
that is a discriminating value between 0 and 1.
44
00:03:30,060 --> 00:03:34,160
But here comes the little trick that we must not forget here.
45
00:03:34,290 --> 00:03:36,210
If you have guessed about it.
46
00:03:36,210 --> 00:03:37,500
Congratulations.
47
00:03:37,500 --> 00:03:39,880
It's actually slightly technical.
48
00:03:39,990 --> 00:03:46,350
This Trig has to do with the result of the convolutions if we have a better look at the architecture
49
00:03:46,350 --> 00:03:52,940
of the neural network of the discriminator we see that it's actually a sequence of convolutions.
50
00:03:53,130 --> 00:04:00,660
But if you remember how a CNN works that is a convolutional neural network composed of several convolutions
51
00:04:00,960 --> 00:04:02,780
that is exactly what we have right here.
52
00:04:02,940 --> 00:04:08,820
Well at the end of the CNN we need to flatten the result of all the convolutions that is the result
53
00:04:08,880 --> 00:04:12,710
of what we get after applying the last convolution.
54
00:04:12,720 --> 00:04:21,330
So the trick well actually the thing that we have to do now is exactly this flattening we have to flatten
55
00:04:21,510 --> 00:04:28,560
the result of the convolutions and we need to do this so that all the elements of the output are along
56
00:04:28,680 --> 00:04:30,300
one same dimension.
57
00:04:30,510 --> 00:04:35,320
And by the way this time engine corresponds to the dimension of the batch size.
58
00:04:35,380 --> 00:04:39,300
So now the question is how do we flatten using pine torch.
59
00:04:39,330 --> 00:04:42,490
Now that is the result of several convolutions.
60
00:04:42,660 --> 00:04:47,350
Well it's actually very easy once you know the trick we have to add here that.
61
00:04:47,520 --> 00:04:54,490
And then we need to use the View function to which we input minus one.
62
00:04:54,660 --> 00:05:01,560
This means nothing else than we want to flatten the result of the convolutions that at the end or in
63
00:05:01,580 --> 00:05:07,460
2D them mentions into one same dimension along one same flattened vector.
64
00:05:07,780 --> 00:05:08,480
All right.
65
00:05:08,650 --> 00:05:09,520
And that's done.
66
00:05:09,520 --> 00:05:11,360
We are done with the forward function.
67
00:05:11,500 --> 00:05:18,570
So congratulations you have made the architecture of the second brain of the deep convolutional Ganns.
68
00:05:18,820 --> 00:05:20,270
So that's quite a big deal.
69
00:05:20,410 --> 00:05:26,350
And now since the architecture is made we can create as many brains of discriminator as we want and
70
00:05:26,350 --> 00:05:28,780
we'll create one in the next to Tauriel.
71
00:05:28,780 --> 00:05:30,550
Until then enjoy computer vision.
7860
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.