Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
1
Hello and welcome to this new tutorial in the previous oil we define the architecture of our discriminator.
2
So now we are one step left to get our second brain.
3
Before that we need to make the forward function we're going to make a new form function this time for
4
the brain of the discriminator.
5
This is going to be almost the same as the forward function we made for the generator.
6
But there is going to be a slight difference.
7
A slight trick not to forget to apply.
8
We'll see that in this tutorial.
9
All right so let's define a new function that we're going to call again forward.
10
There is no danger to call it again forward.
11
And this word function is going to take two arguments the same as before self to refer to the object.
12
And because we're going to use the metal module main to form propagate the signal inside the neural
13
network and the second argument is going to be the input of the discriminator neural network.
14
So keep in mind and keep it well understood the input of the neural network of the discriminator is
15
an image that is going to be one of the images created by the generator.
16
All right so an input of three dimensions corresponding to the three channels.
17
And let's also keep in mind that the output of the discriminator and therefore of this forward function
18
is a discriminating number is going to be of value between 0 and 1 and that will do the discrimination
19
according to which a number close to zero will reject the image and the number close to one will accept
20
the image.
21
So let's recap.
22
The process is actually very easy to understand for discriminator the discriminator takes as inputs
23
an image created by the generator.
24
And for this image it will decide if it wants to accepted or rejected and to make that decision it will
25
return the output.
26
That is the discriminating number between 0 and 1.
27
And if this output is close to zero it will reject it and if it is close to 1 it will accept it.
28
So that's why in some way the discriminator is discriminating the creations of the generator.
29
And so now we perfectly understand the name of what we're implementing the generative adversarial networks.
30
Well that name is perfectly chosen because the discriminator is an adversary of the generator.
31
It is like some kind of an adversary judge judging the creations of the generator judging whether they
32
should be accepted or not.
33
All right so now we understand clearly what's the input and what's the output.
34
Let's go inside the function and let's define what we wanted to do.
35
So the first thing that we need to do is get the output right the output that is returned by the main
36
METAR module of our object which is referred by self.
37
So I'm taking my objects self and then I'm taking the main metal module inside which of course I have
38
to input Well the.
39
All right the input image and image created by the generator.
40
So that returns the output and in the end of course we must not forget to return the output because
41
that's exactly the role of the forward function.
42
Not only it propagates the signal inside the neural network but also and mostly it returns the output
43
that is a discriminating value between 0 and 1.
44
But here comes the little trick that we must not forget here.
45
If you have guessed about it.
46
Congratulations.
47
It's actually slightly technical.
48
This Trig has to do with the result of the convolutions if we have a better look at the architecture
49
of the neural network of the discriminator we see that it's actually a sequence of convolutions.
50
But if you remember how a CNN works that is a convolutional neural network composed of several convolutions
51
that is exactly what we have right here.
52
Well at the end of the CNN we need to flatten the result of all the convolutions that is the result
53
of what we get after applying the last convolution.
54
So the trick well actually the thing that we have to do now is exactly this flattening we have to flatten
55
the result of the convolutions and we need to do this so that all the elements of the output are along
56
one same dimension.
57
And by the way this time engine corresponds to the dimension of the batch size.
58
So now the question is how do we flatten using pine torch.
59
Now that is the result of several convolutions.
60
Well it's actually very easy once you know the trick we have to add here that.
61
And then we need to use the View function to which we input minus one.
62
This means nothing else than we want to flatten the result of the convolutions that at the end or in
63
2D them mentions into one same dimension along one same flattened vector.
64
All right.
65
And that's done.
66
We are done with the forward function.
67
So congratulations you have made the architecture of the second brain of the deep convolutional Ganns.
68
So that's quite a big deal.
69
And now since the architecture is made we can create as many brains of discriminator as we want and
70
we'll create one in the next to Tauriel.
71
Until then enjoy computer vision.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.