pytorch-msssim icon indicating copy to clipboard operation
pytorch-msssim copied to clipboard

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

Open zakajd opened this issue 4 years ago • 3 comments

Hi This code contains the same error as skimage, you can read full description here: https://github.com/scikit-image/scikit-image/issues/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

zakajd avatar Jan 21 '21 19:01 zakajd

Thank you for raising this issue. I will look into adding an optional flag that applies the correct average pooling before the SSIM computation. Note that this is also an issue on the original SSIM from which this repository was forked so you may want to raise this issue there as well.

I will leave the issue open until this is resolved in master.

jorge-pessoa avatar Apr 03 '21 17:04 jorge-pessoa

I don't think it's an error per say, it's not very explicitly mentioned in the paper either, although during the experiments the authors did mention that they downsampled the images. In addition there are two implementations by the author here: http://www.cns.nyu.edu/~lcv/ssim/, with the second implementation similar to the first but with an additional preprocessing step. Nevertheless, I think it's good to take note of this for any perceptual quality tasks:)

charleneolive avatar May 29 '21 12:05 charleneolive

While it's not an error, usage of SSIM without preprocessing leads to a significantly worse performance as a "perceptual quality estimator" which is 90% of its use cases nowadays.

zakajd avatar May 29 '21 12:05 zakajd