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

IW_MaxSquareloss #15

Open
dadafan2343 opened this issue Jul 15, 2021 · 2 comments
Open

IW_MaxSquareloss #15

dadafan2343 opened this issue Jul 15, 2021 · 2 comments

Comments

@dadafan2343
Copy link

Hello,

Thanks for your contribution and work. But I have the problem of "IW_MaxSquareloss":

"IW_MaxSquareloss" error:
for: loss = -torch.sum((torch.pow(prob, 2)weights)[mask]) / (batch_sizeself.num_class)

torch.pow(prob, 2) and weights

RuntimeError: The size of tensor a (4) must match the size of tensor b (2) at non-singleton dimension 1

@sonnefred
Copy link

Hi, have you solved the problem, I met the same error...

@junha1125
Copy link

weights means the weight values to be applied to each pixel of the label(width, hight)

So, I tried below to fix the error

weights = weights.repeat(19,1,1,1).transpose(0,1)  ## add this line
loss = -torch.sum((torch.pow(prob, 2)*weights)[mask]) / (batch_size*self.num_class)

Is it right?? How do you think about it??

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