You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "/home/penglei/anaconda3/envs/segv3/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 213, in forward
return F.nll_loss(input, target, weight=self.weight, ignore_index=self.ignore_index, reduction=self.reduction)
File "/home/penglei/anaconda3/envs/segv3/lib/python3.8/site-packages/torch/nn/functional.py", line 2266, in nll_loss
ret = torch._C._nn.nll_loss2d(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: weight tensor should be defined either for all or no classes at /pytorch/aten/src/THCUNN/generic/SpatialClassNLLCriterion.cu:27
The text was updated successfully, but these errors were encountered:
您好,我用您的segv3训练了一批自己的数据,19分类(包括背景类),比Kitti.yaml中少一类,改了dataloader后输入输出的维度均已对齐,但损失函数报错,希望得到您的帮助
in_vol([16,5,64,2048]), output([16,20,64,2048]), proj_labels([16,64,2048]),self.loss_w([19]),请问还有什么地方需要修改的吗?
proj_labels = proj_labels.squeeze(1).cuda(non_blocking=True).long()
[output, z2, z3, z4, z5] = model(in_vol, proj_mask)
loss = criterion(torch.log(output.clamp(min=1e-8)), proj_labels)+
criterion(torch.log(z5.clamp(min=1e-8)), proj_labels_5)+\
File "/home/penglei/anaconda3/envs/segv3/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 213, in forward
return F.nll_loss(input, target, weight=self.weight, ignore_index=self.ignore_index, reduction=self.reduction)
File "/home/penglei/anaconda3/envs/segv3/lib/python3.8/site-packages/torch/nn/functional.py", line 2266, in nll_loss
ret = torch._C._nn.nll_loss2d(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: weight tensor should be defined either for all or no classes at /pytorch/aten/src/THCUNN/generic/SpatialClassNLLCriterion.cu:27
The text was updated successfully, but these errors were encountered: