Pedestrian-Synthesis-GAN icon indicating copy to clipboard operation
Pedestrian-Synthesis-GAN copied to clipboard

Should person discriminator's loss be back-propagated to generator?

Open bilzard opened this issue 2 years ago • 3 comments

I think discriminator's loss should't be back-propagated to generator. But in the source code, when calculating cropped pedestrian discriminator's loss, the tensor self.person_crop_fake isn't detached. I think it should be detached. Is this a bug?

https://github.com/yueruchen/Pedestrian-Synthesis-GAN/blob/master/models/pix2pix_model.py#L131

bilzard avatar Dec 11 '21 11:12 bilzard

The generator optimizer is applied with zero_grad() before forwarding fake examples. So you dont need to detach here

yifanjiang19 avatar Dec 16 '21 03:12 yifanjiang19

I see. Although it don't affect the training result, I still think doing detach here is a bit better for computation efficiency, right?

bilzard avatar Dec 16 '21 05:12 bilzard

I see. Although it don't affect the training result, I still think doing detach here is a bit better for computation efficiency, right?

Hi. Just wondering if you did ever get this to work ? I mean in Testing mode , generating images?I can train the model, it looks fantastic all is good but when running the test script the images generated are really, really bad. I checked everythng I could in terms of making sure the input tensors look okay when they are passed to the generator, the model is in evaluation mode, etc all looks good with horrible results. It seems such a nice idea but I simply don't see how the author made this work using the code from git.

Latzi avatar Nov 28 '23 11:11 Latzi