VainF / pytorch-msssim

Fast and differentiable MS-SSIM and SSIM for pytorch.
MIT License
1.1k stars 126 forks source link

MS_SSIM #13

Closed ChafikBak closed 4 years ago

ChafikBak commented 4 years ago

Hi,

I used MS_SSIM with default win_size=11 and default weights = [0.0448, 0.2856, 0.3001, 0.2363, 0.1333]

my input image size is 64x64

So, I get this error :

RuntimeError: Calculated padded input size per channel: (8 x 8). Kernel size: (1 x 11). Kernel size can't be greater than actual input size

VainF commented 4 years ago

Hi @ChafikBak. There are 4 downsamples with padding in ms-ssim, so your image should be larger than (winsize-1) 2^(5-1) = 10 16 = 160.

Maybe I should add some checks before execution.

ChafikBak commented 4 years ago

Hi @VainF Thanks, yes it will be nice if you add some checks according to input image size.

VainF commented 4 years ago

Sorry, I made a mistake on the required input size. The image size should be larger than 160 if win_size=11 because only 4 downsamples are required for 5 levels.