**生成对抗网络**(**GAN**)由 Ian Goodfellow 于 2014 年发明,从那时起,它们使整个 AI 社区颠倒了。 它们是最简单,最明显的实现方式之一,但具有以其功能吸引世界的力量。 在 GAN 中,两个网络相互竞争并达到平衡,生成器网络可以生成数据,而鉴别器网络很难与实际图像区分开来。 一个真实的例子就是警察与假冒者之间的斗争。
**生成对抗网络**(**GAN**)由 Ian Goodfellow 于 2014 年发明,从那时起,它们使整个 AI 社区颠倒了。 它们是最简单,最明显的实现方式之一,但具有以其功能吸引世界的力量。 在 GAN 中,两个网络相互竞争并达到平衡,生成器网络可以生成数据,而判别器网络很难与实际图像区分开来。 一个真实的例子就是警察与假冒者之间的斗争。
造假者试图制造假币,而警察试图对其进行侦查。 最初,造假者知识不足,无法制作出看起来很原始的假币。 随着时间的流逝,造假者越来越擅长制作看起来更像原始货币的货币。 然后,警察开始无法识别假币,但最终他们会再次变得更好。 这一世代歧视过程最终导致了平衡。 GAN 的优势是巨大的,我们将在后面详细讨论。
当判别器 A 获得马的真实图像时,判别器 B 从 A2B 获得斑马的生成图像,当判别器 B 获得斑马的真实图像时,判别器 A 从 B2A 获得马的生成图像。 要注意的一点是,鉴别器 A 总是能够预测图像是否来自马具,而鉴别器 B 总是能够预测图像是否来自斑马具。 同样,A2B 始终负责将马集合映射到斑马分布,而 B2A 始终负责将斑马集合映射到马分布。
当判别器 A 获得马的真实图像时,判别器 B 从 A2B 获得斑马的生成图像,当判别器 B 获得斑马的真实图像时,判别器 A 从 B2A 获得马的生成图像。 要注意的一点是,判别器 A 总是能够预测图像是否来自马具,而判别器 B 总是能够预测图像是否来自斑马具。 同样,A2B 始终负责将马集合映射到斑马分布,而 B2A 始终负责将斑马集合映射到马分布。
@@ -545,7 +545,7 @@ A brief word on the way options are passed to built-in modules like `Conv2d` in
The discriminator is similarly a sequence of convolutions, batch normalizations and activations. However, the convolutions are now regular ones instead of transposed, and we use a leaky ReLU with an alpha value of 0.2 instead of a vanilla ReLU. Also, the final activation becomes a Sigmoid, which squashes values into a range between 0 and 1\. We can then interpret these squashed values as the probabilities the discriminator assigns to images being real.
To build the discriminator, we will try something different: a <cite>Sequential</cite> module. Like in Python, PyTorch here provides two APIs for model definition: a functional one where inputs are passed through successive functions (e.g. the generator module example), and a more object-oriented one where we build a <cite>Sequential</cite> module containing the entire model as submodules. Using <cite>Sequential</cite>, the discriminator would look like:
To build the discriminator, we will try something different: a Sequential module. Like in Python, PyTorch here provides two APIs for model definition: a functional one where inputs are passed through successive functions (e.g. the generator module example), and a more object-oriented one where we build a Sequential module containing the entire model as submodules. Using Sequential, the discriminator would look like: