pytorch-unsupervised-segmentation-tip
pytorch-unsupervised-segmentation-tip copied to clipboard
Scribble Loss Target 8 is out of bounds
When using scribble loss with the demo picture (cat) 2007_001774.jpg and 2007_001774_scribble.png in the loss function I get the error:
IndexError: Target 8 is out of bounds.
if args.scribble:
loss = args.stepsize_sim * loss_fn(output[ inds_sim ], target[ inds_sim ]) + args.stepsize_scr * loss_fn_scr(output[ inds_scr ], target_scr[ inds_scr ].long()) + args.stepsize_con * (lhpy + lhpz)
else:
loss = args.stepsize_sim * loss_fn(output, target) + args.stepsize_con * (lhpy + lhpz)
Traceback (most recent call last):
File "C:\Users\PycharmProjects\scribbleLoss\main.py", line 175, in <module>
stepszie_scr *loss_fn_scr(output[inds_scr], target_scr[inds_scr].long()) + \
File "C:\Usersl\PycharmProjects\scribbleLoss\venv\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\PycharmProjects\scribbleLoss\venv\lib\site-packages\torch\nn\modules\loss.py", line 1120, in forward
return F.cross_entropy(input, target, weight=self.weight,
File "C:\Users\PycharmProjects\scribbleLoss\venv\lib\site-packages\torch\nn\functional.py", line 2824, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
IndexError: Target 8 is out of bounds.
Without scribble everything is working fine and I do not see the issue. I also added the .long() from issue https://github.com/kanezaki/pytorch-unsupervised-segmentation-tip/issues/4 but it seems like I still have another issue here.