Hello,thanks for your great work.I had some problems before the model training started.I tried to adjust the image but it didn't work.Please give me some advice.The following is the error message
Traceback (most recent call last):
File "/root/autodl-tmp/XNET/XNet-main/XNet-main/train_semi_XNet.py", line 254, in
loss_train_sup1 = criterion(pred_train_sup1, mask_train_sup)
File "/root/miniconda3/envs/xnet3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/autodl-tmp/XNET/XNet-main/XNet-main/loss/loss_function.py", line 119, in forward
return self._base_forward(output, target_one_hot, valid_mask)
File "/root/autodl-tmp/XNET/XNet-main/XNet-main/loss/loss_function.py", line 92, in _base_forward
dice_loss = dice(predict[:, i], target[..., i], valid_mask)
File "/root/miniconda3/envs/xnet3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/autodl-tmp/XNET/XNet-main/XNet-main/loss/loss_function.py", line 59, in forward
num = torch.sum(torch.mul(predict, target) * valid_mask, dim=1) * 2 + self.smooth
RuntimeError: The size of tensor a (16384) must match the size of tensor b (49152) at non-singleton dimension 1
Hello,thanks for your great work.I had some problems before the model training started.I tried to adjust the image but it didn't work.Please give me some advice.The following is the error message
Traceback (most recent call last):
File "/root/autodl-tmp/XNET/XNet-main/XNet-main/train_semi_XNet.py", line 254, in
loss_train_sup1 = criterion(pred_train_sup1, mask_train_sup)
File "/root/miniconda3/envs/xnet3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/autodl-tmp/XNET/XNet-main/XNet-main/loss/loss_function.py", line 119, in forward
return self._base_forward(output, target_one_hot, valid_mask)
File "/root/autodl-tmp/XNET/XNet-main/XNet-main/loss/loss_function.py", line 92, in _base_forward
dice_loss = dice(predict[:, i], target[..., i], valid_mask)
File "/root/miniconda3/envs/xnet3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/autodl-tmp/XNET/XNet-main/XNet-main/loss/loss_function.py", line 59, in forward
num = torch.sum(torch.mul(predict, target) * valid_mask, dim=1) * 2 + self.smooth
RuntimeError: The size of tensor a (16384) must match the size of tensor b (49152) at non-singleton dimension 1