File "train_R50.py", line 285, in <module>
main()
File "train_R50.py", line 147, in main
main_loss = criterion(outputs, labels)
File "/data/wdh/.conda/envs/AI_studywdh/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
result = self.forward(*input, **kwargs)
File "/data/wdh/MSCG-Net-master/MSCG-Net-master/lib/loss/acw_loss.py", line 23, in forward
one_hot_label, mask = self.encode_one_hot_label(pred, target)
File "/data/wdh/MSCG-Net-master/MSCG-Net-master/lib/loss/acw_loss.py", line 70, in encode_one_hot_label
one_hot_label.scatter_(0, target.unsqueeze(1),1)
RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #3 'index'
This problem has bothered me for several days. At first I thought it was a label problem, so I changed the rgb label to a single-channel label. But still this error still exists. May I ask what causes this?
Encountered an error problem:
pred:torch.Size([10, 7, 512, 512])
target:torch.Size([10, 512, 512])
This problem has bothered me for several days. At first I thought it was a label problem, so I changed the rgb label to a single-channel label. But still this error still exists. May I ask what causes this?