Soo Kyung Kim
Department of AI
GAN Implementation
GAN in a NutShell - High-level idea
GAN in a NutShell - Discriminator
z
G(z)
D(x)
p(real)
Discriminator
x
For real image x, the discriminator wants to output high p(real).
(Dθ(x) → 1)
For an image generated by G, the discriminator wants to output low p(real).
(Dθ(Gθ(z)) → 0)
GAN in a NutShell - Generator
z
G(z)
D(x)
p(real)
Discriminator
x
Nothing to do when D takes a real example.
When G generates an image, its goal is to increase p(real) output of D with it, by producing a real-like image.
(Dθ(Gθ(z)) → 1)
Generator
Training GAN
GAN in a NutShell - DCGAN
Generator
Discriminator
5×5 deconv
stride=2
5×5 deconv
stride=2
5×5 deconv
stride=2
5×5 deconv
stride=2
5×5 conv
stride=2
5×5 conv
stride=2
5×5 conv
stride=2
5×5 conv
stride=2
Deconvolution layer
https://www.tensorflow.org/api_docs/python/tf/keras/layers/Conv2DTranspose
Transposed convolutions to use a transformation going in the opposite direction of a normal convolution,
i.e., from something that has the shape of the output of some convolution to something that has the shape of its input while maintaining a connectivity pattern that is compatible with said convolution.
Gradient Tape: Record operations for automatic differentiation.��
https://www.tensorflow.org/api_docs/python/tf/GradientTape
Step-by-Step guideline of DCGAN�implementation with Tensorflow