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

SSIM result is different from skimage.measure.compare_ssim

Open Pixie8888 opened this issue 4 years ago • 2 comments

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?

Pixie8888 avatar Aug 25 '21 07:08 Pixie8888

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)

VainF avatar Aug 25 '21 10:08 VainF

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?

Pixie8888 avatar Aug 27 '21 07:08 Pixie8888