我对DCGAN进行了研究,并对此有一些疑问。
在伊恩·古德费罗的自然GAN中,判别器模型输出一个标量值,这意味着概率。但DCGAN的甄别器是用CNN架构设计的。我知道CNN的输出是阶级概率的向量。
那么鉴别器是如何在DCGAN上工作的呢?DCGAN鉴别器的输出是什么?
发布于 2017-12-21 05:52:27
有关详细答案,请参见TensorFlow中基于深度学习的图像处理。
简单地说:假设你做了一个CNN,它有n个输入大小的过滤器和有效的填充。然后输出为nx1x1,然后可以将softmax应用于该形状,并且在通道中有概率。
你也许也想读一下我硕士论文的2.2.1。卷积层。
发布于 2018-12-11 00:52:46
判别器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)有关更多细节,请访问到这里来
https://stackoverflow.com/questions/47887328
复制相似问题