When calculating SSIM using skimage, getting error

12 views Asked by At

I was working with an image colorization problem. When i was trying to calculate SSIM using skimage it's getting this error.

ValueError: win_size exceeds image extent. Either ensure that your images are at least 7x7; or pass win_size explicitly in the function call, with an odd value less than or equal to the smaller side of your images. If your images are multichannel (with color channels), set channel_axis to the axis number corresponding to the channels.

This is the code I used.

from skimage.metrics import structural_similarity as ssim

ssim_value = ssim(color_img.permute(0, 2, 3, 1).cpu().numpy(), predictions.permute(0, 2, 3, 1).cpu().numpy(), multichannel=True, data_range=1.0, channel_axis=3)
        ssim_values.append(ssim_value)

shape of color_img and predictions is torch.Size([4, 3, 150, 150])

this should return the SSIM value but getting the error. why?

0

There are 0 answers