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

Flow not perfectly invertible #45

Open
sidney1505 opened this issue Aug 3, 2022 · 4 comments
Open

Flow not perfectly invertible #45

sidney1505 opened this issue Aug 3, 2022 · 4 comments

Comments

@sidney1505
Copy link

Hi, given an input image tensor x and extracting the glow model i tried the following:

latent = glow(x)[2]
x_reconstructed = glow.reverse(latent)

Since it is a normalizing flow one would expect, that x_reconstructed is very similar to x, since the only source of errors should be rounding errors. However, I observe very big differences. Does anybody has an explanation for that?

@gitlabspy
Copy link

Glow has a downsample layer which just throws away a half of data (along channel). In the reverse process, the threw-away part is sampled from a prior. You can modify the codes to keep those threw-away parts and replace them with the sampling process, then you can get a perfectly inverted results.

@Moleculebo
Copy link

Hi, do you have solved this problem? could you share that? thanks a lot!

@ThoseBygones
Copy link

Hi, given an input image tensor x and extracting the glow model i tried the following:

latent = glow(x)[2] x_reconstructed = glow.reverse(latent)

Since it is a normalizing flow one would expect, that x_reconstructed is very similar to x, since the only source of errors should be rounding errors. However, I observe very big differences. Does anybody has an explanation for that?

Hi, I once suspect that there is something wrong with this code, but I re-read the code carefully and notice this line:

https://github.com/rosinality/glow-pytorch/blob/master/model.py#L301

So your code can be modified to the following:

latent = glow(x)[2]
x_rec = glow.reverse(latent, reconstruct=True)

@VV20192019
Copy link

Hi, given an input image tensor x and extracting the glow model i tried the following:
latent = glow(x)[2] x_reconstructed = glow.reverse(latent)
Since it is a normalizing flow one would expect, that x_reconstructed is very similar to x, since the only source of errors should be rounding errors. However, I observe very big differences. Does anybody has an explanation for that?

Hi, I once suspect that there is something wrong with this code, but I re-read the code carefully and notice this line:

https://github.com/rosinality/glow-pytorch/blob/master/model.py#L301

So your code can be modified to the following:

latent = glow(x)[2]
x_rec = glow.reverse(latent, reconstruct=True)

Thanks, it works.

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