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 result is different from skimage.measure.compare_ssim #30

Open
Pixie8888 opened this issue Aug 25, 2021 · 2 comments
Open

SSIM result is different from skimage.measure.compare_ssim #30

Pixie8888 opened this issue Aug 25, 2021 · 2 comments

Comments

@Pixie8888
Copy link

Hi,
Thanks for this tool. I use both pytorch_mssim.ssim and skimage.measure.compare_ssim to compute ssim, but the results are different. For example, ssim evaluation on an image sequence:
pytorch_msssim.ssim: [0.9655, 0.9500, 0.9324, 0.9229, 0.9191, 0.9154]
skimage.measure.compare_ssim: [0.97794482, 0.96226299, 0.948432, 0.9386946, 0.93113704, 0.92531453]

Why will this happen?

@VainF
Copy link
Owner

VainF commented Aug 25, 2021

Hi @Pixie412 , may be the inconsistency was caused by the paramters of skimage.measure.compare_ssim

You may want to use it as follows:

ssim_skimage = structural_similarity(img, img_noise, win_size=11, multichannel=True,
                                    sigma=1.5, data_range=255, use_sample_covariance=False, gaussian_weights=True)

@Pixie8888
Copy link
Author

Pixie8888 commented Aug 27, 2021

Hi, I use the evaluation code below:
for skimage.measure.compare_ssim, I calculate ssim along each channel, then average them.
image
gt[t][i].shape = (b,3,h,w), value range(0,1), numpy float16
result:(0.9767,0.9038,0.8849)

for pytorch_msssim: from pytorch_msssim import ssim as ssim_func
image
img[opt.n_past:][t].shape = (b,3,h,w), value range(0,1), torch.cuda.FloatTensor
result:(0.9688, 0.8888, 0.8743)
Why are results still different?

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