aitorzip / PyTorch-CycleGAN

A clean and readable Pytorch implementation of CycleGAN
https://arxiv.org/abs/1703.10593
GNU General Public License v3.0
1.19k stars 283 forks source link

Discriminator Activation #8

Open sachinruk opened 5 years ago

sachinruk commented 5 years ago

I couldn't help but notice that the discriminator did not have a sigmoid activation. Is there any reason for this? (https://github.com/aitorzip/PyTorch-CycleGAN/blob/67da8f9e2b69bd68763451803c7700aaccc92f18/models.py#L92)

Einstellung commented 4 years ago

Actually we use Fully Convolutional Networks in Discriminator, maybe you have noticed that before we use avg_pool we have this code: model += [nn.Conv2d(512, 1, 4, padding=1)] after this the output channel is 13030, and next we use code return F.avg_pool2d(x, x.size()[2:]).view(x.size()[0], -1), then return channel shape is 1*1, so there is no need to use sigmoid function. We use the average pooling method instead of the fully connection layer can reduce the network size, and it helps to reduce over-fitting.