【问题标题】:How discriminator works on DCGAN?DCGAN 上的鉴别器是如何工作的?
【发布时间】:2018-12-11 08:52:46
【问题描述】:

我正在研究 DCGAN,我想知道一些关于它的事情。

在 Ian Goodfellow 的自然 GAN 中,判别器模型输出一个标量值,即概率。 但 DCGAN 的判别器采用 CNN 架构设计。我知道 CNN 的输出是类概率向量。

那么鉴别器在 DCGAN 上是如何工作的? DCGAN的判别器的输出是什么?

【问题讨论】:

标签: deep-learning dcgan


【解决方案1】:

请参阅Image Completion with Deep Learning in TensorFlow 以获得详细答案。

简而言之:假设你制作了一个 CNN,它有 n 个输入大小的过滤器和有效填充。然后输出的形状将是 n x 1 x 1。然后您可以将 softmax 应用于该形状,并且您可以在通道中获得概率。

您可能还想阅读我的硕士论文2.2.1. Convolutional Layers

【讨论】:

    【解决方案2】:

    判别器 D 以 3x64x64(例如)输入图像,通过一系列 Conv2d、BatchNorm2d 和 LeakyReLU 层对其进行处理,并通过Sigmoid 激活函数。

    让我们看一个示例代码来了解它的输入和输出。

    class Discriminator(nn.Module):
    def __init__(self, ngpu):
        super(Discriminator, self).__init__()
        self.ngpu = ngpu
        self.main = nn.Sequential(
    
            nn.Conv2d(nc, ndf, 4, 2, 1, bias=False),
            nn.LeakyReLU(0.2, inplace=True),
    
            nn.Conv2d(ndf, ndf*2, 4, 2, 1, bias=False),
            nn.BatchNorm2d(ndf*2),
            nn.LeakyReLU(0.2, inplace=True),
    
            nn.Conv2d(ndf*2, ndf*4, 4, 2, 1, bias=False),
            nn.BatchNorm2d(ndf*4),
            nn.LeakyReLU(0.2, inplace=True),
    
            nn.Conv2d(ndf*4, ndf*8, 4, 2, 1, bias=False ),
            nn.BatchNorm2d(ndf*8),
            nn.LeakyReLU(0.2, inplace=True),
    
            nn.Conv2d(ndf*8, 1, 4, 1, 0, bias=False),
            nn.Sigmoid()
    
        )
    
    def forward(self, input):
        return self.main(input)
    

    更多详情,visit here

    【讨论】:

      猜你喜欢
      • 2021-08-23
      • 1970-01-01
      • 2022-01-16
      • 1970-01-01
      • 2013-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多