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

Big in SSIM implementation, don't use this code for perceptual quality estimation #35

Open
zakajd opened this issue Jan 21, 2021 · 4 comments

Comments

@zakajd
Copy link

zakajd commented Jan 21, 2021

Hi
This code contains the same error as skimage, and pytorch-ssim you can read full description here: scikit-image/scikit-image#5192

Shortly, when used for estimation of perceptual quality, authors of original paper proposed to downsample images first to make SSIM focus on major differences between reference and distorted inputs.

So what?
If you are using this implementation as a loss function for CNN, you're likely leading it in the wrong direction.

Alternatives
You can find correct implementation of SSIM, MS-SSIM and some other metrics here:
https://github.com/photosynthesis-team/piq

@lijx10
Copy link

lijx10 commented Mar 7, 2021

According to Tensorflow's official SSIM code https://www.tensorflow.org/api_docs/python/tf/image/ssim, there isn't the average pooling when image size > 256. So I wonder whether the SSIM proposed here https://github.com/photosynthesis-team/piq should be adopted especially when using SSIM as a metric.

@zakajd
Copy link
Author

zakajd commented Mar 7, 2021

@lijx10
Implementation in PIQ is identical to TF with 1e-4 with flag ‘downsample=False’. Image quality assessment metrics are evaluated not on basis of similarity to TensorFlow code, but on basis of prediction quality and correlation with human judgments.

So the issue with TF is that it poorly measures “perceptual distance” between 2 images and thus it’s better not to use it as a guidance for model optimisation or model selection.

@lijx10
Copy link

lijx10 commented Mar 8, 2021

Do you mean that the pytorch-ssim is identitcal with TF official SSIM, and both of them are lack of the downsample implementation?

@zakajd
Copy link
Author

zakajd commented Mar 8, 2021

Yes, that’s true.
Please see link to skimage issue where I described this in greater details

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