Traceback (most recent call last):
File "D:\paperin\a_new_road\DCSAU-Net-main\train.py", line 176, in
model_ft, Loss_list, Accuracy_list = train_model(model_ft, criterion, optimizer_ft, exp_lr_scheduler,
File "D:\paperin\a_new_road\DCSAU-Net-main\train.py", line 85, in train_model
loss = criterion(outputs, labels)
File "D:\ProgramData\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
return forward_call(*input, *kwargs)
File "D:\paperin\a_new_road\DCSAU-Net-main\loss.py", line 65, in forward
intersection = (inputs targets).sum()
RuntimeError: The size of tensor a (256) must match the size of tensor b (3) at non-singleton dimension 4
请问我该如何解决这个问题,我使用的是Kavisr数据集,代码没有任何改动,但是出现了这个错误 Epoch 0/149
Traceback (most recent call last): File "D:\paperin\a_new_road\DCSAU-Net-main\train.py", line 176, in
model_ft, Loss_list, Accuracy_list = train_model(model_ft, criterion, optimizer_ft, exp_lr_scheduler,
File "D:\paperin\a_new_road\DCSAU-Net-main\train.py", line 85, in train_model
loss = criterion(outputs, labels)
File "D:\ProgramData\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
return forward_call(*input, *kwargs)
File "D:\paperin\a_new_road\DCSAU-Net-main\loss.py", line 65, in forward
intersection = (inputs targets).sum()
RuntimeError: The size of tensor a (256) must match the size of tensor b (3) at non-singleton dimension 4
这个地方调试的inputs是Tensor(8, 1, 256, 256),但是targets是Tensor(8, 1, 256, 256, 3),请问是需要修改什么还是我数据集划分的问题 数据集划分 ├── data ├── images ├── cju0qkwl35piu0993l0dewei2.png ....... ├── masks ├── cju0qkwl35piu0993l0dewei2_segmentation.png .......