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

SSIM are negative #31

Open
icey-zhang opened this issue Dec 23, 2020 · 2 comments
Open

SSIM are negative #31

icey-zhang opened this issue Dec 23, 2020 · 2 comments

Comments

@icey-zhang
Copy link

Hello, what's wrong with code that comes out with negative values?

@nickdalfarra
Copy link

I'm not 100% sure, but there seem to be different conventions on the range of SSIM implementations. Some output to [0,1], others to [-1,1]. I don't have an example of two images producing a perfectly bad SSIM of -1, but you could always just linearly transform the SSIM output via (SSIM + 1)/2 to make the range [0,1].

@TalTaiber
Copy link

Hello, what's wrong with code that comes out with negative values?

Just a guess, since the author did not repond:
Higher SSIM corresponds to greater similarity between the two images. However, notice that in the author's explanation we have:
ssim_loss = pytorch_ssim.SSIM()
Since the optimizer tries to minimize the loss, we have to define the SSIM loss as negative SSIM, so that when the loss is low the SSIM will be high.

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