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

Sigmoid missing in hr_new? #45

Closed
KacperKazan opened this issue Sep 26, 2022 · 2 comments
Closed

Sigmoid missing in hr_new? #45

KacperKazan opened this issue Sep 26, 2022 · 2 comments

Comments

@KacperKazan
Copy link

Hello, I've noticed that when using the hr_new network the rec_fake (output of the generator) seems to have an unbounded value range. Compared to the loaded fake and real image which have pixels values bounded between [0, 1]

if generator_type == 'hr':
generator = nw.ResidualGenerator(nw.make_ienet(self.gen_cfg))
pass
elif generator_type == 'hr_new':
generator = PassthruGenerator(nw.make_ienet2(self.gen_cfg))
pass

The 'hr' option uses the ResidualGenerator which uses a sigmoid on the output to bound the output between [0, 1]

@torch.jit.script
def make_residual(img, x):
return torch.sigmoid(-torch.log(1 / img.clamp(min=0.001, max=0.999) - 1) + x)

However the PassthruGenerator which 'hr_new' uses doesn't have any sigmoid on the output.

Is this a bug? since it seems that the output image should be bounded [0,1] just as the real image is

@nmaanvi
Copy link

nmaanvi commented Oct 6, 2022

Hello, I am facing a similar problem. The outputs of the generator are NaN sometimes because there is no bound. It would be great if you could share how to fix this. Thanks!

@nmaanvi nmaanvi mentioned this issue Oct 6, 2022
@srrichter
Copy link
Collaborator

We removed the sigmoid in the updated version since it seemed not to be necessary with the setup we ran. If you're playing with different datasets or are facing issues with larger values, including the sigmoid is a good idea.

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

3 participants