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

TypeError:Input max_val type is not a float. Got <class 'str'>. #19

Open
fairytalell opened this issue Aug 28, 2021 · 2 comments
Open

Comments

@fairytalell
Copy link

I used my mini-dataset. When I ran train.py, I got the error.
Later, I found kornia.losses.ssim() parameter type is not correct in class SSIM.

source code:
class SSIM(nn.Module):
def init(self, window_size=11):
super(SSIM, self).init()
self.window_size = window_size

def forward(self, x, y):
    if x.shape[1] == 3:
        x = kornia.color.rgb_to_grayscale(x)
    if y.shape[1] == 3:
        y = kornia.color.rgb_to_grayscale(y)
    return 1 - kornia.losses.ssim(x, y, self.window_size, 'mean')

kornia library requires max_val is float instead of str,i.e.,'mean'.
What's wrong with me, please? Or is there a problem with the source code?

My environment is:
kornia 0.5.8
python 3.7.0
pytorch 1.7.0

@HarshWinterBytes
Copy link

I also met this problem! Could you please tell me how to slove it?

@fairytalell
Copy link
Author

fairytalell commented Mar 23, 2022 via email

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