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

Unsupported for grayscale image with 1 channel or 2D input? #24

Open
Ford666 opened this issue Nov 5, 2020 · 3 comments
Open

Unsupported for grayscale image with 1 channel or 2D input? #24

Ford666 opened this issue Nov 5, 2020 · 3 comments

Comments

@Ford666
Copy link

Ford666 commented Nov 5, 2020

It seems that whether the class SSIM/MS_SSIM or the function ssim/msssim are all unsupported for the input with 1 channel. When I fed the ssim function with input array of size (1,1,1984,1984), I encountered the following error:

dim' is an invalid keyword argument for squeeze()

What's more, only 4D numpy array is supported, but not for 2D image, which requires expanding dimension first before being processed. This is also not very convenient. Please consider adding some parameters/functions for more versatile usage. Thanks for your efforts!

@VainF
Copy link
Owner

VainF commented Nov 5, 2020

Hi @Ford666, please make sure that the input is a torch.Tensor.

@Ford666
Copy link
Author

Ford666 commented Nov 5, 2020

@VainF Yeah it works, thank you! So the input must be a torch.Tensor but without limit on its channel number.

@Ford666 Ford666 changed the title Unsupported for grayscale image with 1 channel 1or 2D input? Unsupported for grayscale image with 1 channel or 2D input? Nov 5, 2020
@WYCAS
Copy link

WYCAS commented Oct 18, 2021

@VainF Yeah it works, thank you! So the input must be a torch.Tensor but without limit on its channel number.

I have some grayscale images,when i input 2D tensor,it reported bug.

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

3 participants