Open ShangGY805 opened 2 months ago
Hello, when I run the train_SCD_psd.py file, I encounter the following problem:
Traceback (most recent call last): File "train_SCD_psd.py", line 356, in main() File "train_SCD_psd.py", line 111, in main train(train_loader, net, criterion, optimizer, val_loader) File "train_SCD_psd.py", line 217, in train loss_seg = criterion(outputs_A, labels_A) + criterion(outputs_B, labels_B) File "/home/ubuntu/miniconda3/envs/change2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, *kwargs) File "/data/sgy2/SCanNet-main/utils/loss.py", line 13, in forward return self.nll_loss(F.log_softmax(inputs, dim=1), targets) File "/home/ubuntu/miniconda3/envs/change2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(input, **kwargs) File "/home/ubuntu/miniconda3/envs/change2/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 216, in forward return F.nll_loss(input, target, weight=self.weight, ignore_index=self.ignore_index, reduction=self.reduction) File "/home/ubuntu/miniconda3/envs/change2/lib/python3.8/site-packages/torch/nn/functional.py", line 2701, in nll_loss return torch._C._nn.nll_loss_nd(input, target, weight, _Reduction.get_enum(reduction), ignore_index) RuntimeError: only batches of spatial targets supported (3D tensors) but got targets of size: : [8, 512, 512, 3]
Update this in train function
and update validate function as,
Hello, when I run the train_SCD_psd.py file, I encounter the following problem: