Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why does not the discriminator output a scalar #66

Closed
breadbread1984 opened this issue Dec 26, 2017 · 4 comments
Closed

why does not the discriminator output a scalar #66

breadbread1984 opened this issue Dec 26, 2017 · 4 comments

Comments

@breadbread1984
Copy link

As far as I understand, the output of the discriminator outputs a scalar which represents whether the input comes from natural image set or generated image set. But I find that your discriminator outputs a 32x32 tensor. Could you explain the reason of that? Thx

@phillipi
Copy link
Collaborator

This is because we use a "PatchGAN" discriminator, described in Section 3.2.2 of this paper. See more details here: junyanz/pytorch-CycleGAN-and-pix2pix#39

@knaffe
Copy link

knaffe commented Jun 2, 2018

I have a question on the implement of PatchGAN. In the Section 3.2.2 of the paper motioned above, it said

We run this discriminator convolutationally across the image, averaging all responses to provide the ultimate output of D.

But I couldn't find anywhere to implement of this averaging operation?
In the code, the D outputs the 30x30x1, and the loss of D is calculated by the GANLoss function(MSE or BCE loss). So, where does the averaging operation? Maybe I miss something.
Thank you !

@DISAPPEARED13
Copy link

Hi, @knaffe and @phillipi . I am confused for using different loss function. The option is MSELoss() and BCEWithLogits(), but when I used BCE, my generator loss shows a very large oscillation and MSE with more steady around 0.5
In some answers people mention that https://stats.stackexchange.com/questions/242907/why-use-binary-cross-entropy-for-generator-in-adversarial-networks sigmoid with bce calculate the probability for the Discriminator to set loss.
Thank you!

@junyanz
Copy link
Owner

junyanz commented Mar 1, 2022

MSELoss has been shown to be more stable than the vanilla GAN loss. See this paper for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants