Skip to content
New issue

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

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

Already on GitHub? # to your account

About discriminator loss #83

Closed
qibao77 opened this issue May 26, 2020 · 1 comment
Closed

About discriminator loss #83

qibao77 opened this issue May 26, 2020 · 1 comment

Comments

@qibao77
Copy link

qibao77 commented May 26, 2020

Why there are two types of discriminator loss as follows:
# pred_d_real = self.netD(self.var_ref)
# pred_d_fake = self.netD(self.fake_H.detach()) # detach to avoid BP to G
# l_d_real = self.cri_gan(pred_d_real - torch.mean(pred_d_fake), True)
# l_d_fake = self.cri_gan(pred_d_fake - torch.mean(pred_d_real), False)
# l_d_total = (l_d_real + l_d_fake) / 2
# l_d_total.backward()
pred_d_fake = self.netD(self.fake_H.detach()).detach()
pred_d_real = self.netD(self.var_ref)
l_d_real = self.cri_gan(pred_d_real - torch.mean(pred_d_fake), True) * 0.5
l_d_real.backward()
pred_d_fake = self.netD(self.fake_H.detach())
l_d_fake = self.cri_gan(pred_d_fake - torch.mean(pred_d_real.detach()), False) * 0.5
l_d_fake.backward()

@xinntao
Copy link
Collaborator

xinntao commented Jul 8, 2020

The discriminator has two losses for real and fake samples, respectively~

@xinntao xinntao closed this as completed Jul 8, 2020
Z-Fran added a commit that referenced this issue Dec 21, 2022
* Merge branch 'cndocs' of https://github.com/AlexZou14/mmediting into cndocs

* Add Restormer

* Add einops

* Create test_restormer_net.py

* Refactor deraining config

* Update restormer_net.py

* Refactor config

* Update restormer_official_rain13k.py

* Update deraining_test_config.py

* Fix Restormer Readme

* Fix runtime.txt

* refactor configs

* rename deblurring config

* rename deblurring config

* Fix config and Fix docstring

* Update runtime.txt

* fix typo

* remove edit_dual_data_preprocessor

* Fix test_restormer_net.py typo

* Add denoising_real and fix config typo

* Fix Some typo

* Fix Typo

* fix configs

* fix dpdd dataset

* fix readme

* Fix Readme

* Fix README_zh-CN

* Fix Typo

* support dual deblur and fix pad

* fix ut

* update metrics

* Fix test_dual_restormer

* fix ut

* fix typo

Co-authored-by: Z-Fran <1396925302@qq.com>
Co-authored-by: Z-Fran <49083766+Z-Fran@users.noreply.github.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants