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

Bug in the Gaussian noise layer? #6

Closed
kjerk opened this issue Jun 3, 2021 · 2 comments
Closed

Bug in the Gaussian noise layer? #6

kjerk opened this issue Jun 3, 2021 · 2 comments

Comments

@kjerk
Copy link

kjerk commented Jun 3, 2021

Hello, I know it's been quite a while since the publication of the code but I wanted to check on a difference between the paper and the code.

According to the paper, Gaussian noise is meant to be injected in each of the RRDB blocks, but it looks like in the code there is an extra check disabling the noise unless the model is in training mode only. block.py:118

...
if self.training and self.sigma != 0:
    scale = self.sigma * x.detach() if self.is_relative_detach else self.sigma * x
    sampled_noise = self.noise.repeat(*x.size()).normal_() * scale
    x = x + sampled_noise
...

This would mean that for all times the model is used in model.eval() mode including in both test.py:18 test.py:56 scripts, that the Gaussian noise is actually disabled, which would affect the metrics and output.

I have double checked this myself by running an evaluation tensor through the model in training and eval modes and the outputs are different. So my questions is, is Gaussian noise meant to only be injected during training, or should the self.training check be removed?

...
if self.sigma != 0:
    scale = self.sigma * x.detach() if self.is_relative_detach else self.sigma * x
    sampled_noise = self.noise.repeat(*x.size()).normal_() * scale
    x = x + sampled_noise
...
@ncarraz
Copy link
Owner

ncarraz commented Jun 3, 2021

Hello,
Thank you for pointing that out. The noise injection for this work is only for training. We extented this in another work (https://arxiv.org/abs/2009.12177) which exploits the noise during test time.

@kjerk
Copy link
Author

kjerk commented Jun 3, 2021

Ah very cool, thank you for the clarification! (And the link to the new paper.)

@ncarraz ncarraz closed this as completed Jun 4, 2021
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

2 participants