lee-zq/3DUNet-Pytorch

维度问题

Opened this issue · 5 comments

File "/opt/data/private/3DUNet-Pytorch-master/dataset/transforms.py", line 153, in call
img, mask = t(img, mask)
File "/opt/data/private/3DUNet-Pytorch-master/dataset/transforms.py", line 64, in call
tmp_img[:,:es-ss] = img[:,ss:es]
RuntimeError: The expanded size of the tensor (48) must match the existing size (36) at non-singleton dimension 1. Target sizes: [1, 48, 256, 256]. Tensor sizes: [36, 256, 256]

正常读入数据集,出现这样的报错是什么原因呀?

我在训练的时候也越大维度不匹配的问题。
dice += (pred[:,i] * target[:,i]).sum(dim=1).sum(dim=1).sum(dim=1) / ((pred[:,i] * target[:,i]).sum(dim=1).sum(dim=1).sum(dim=1)+ RuntimeError: The size of tensor a (512) must match the size of tensor b (256) at non-singleton dimension 3

请问你们解决了吗

mask可以不用做降采样操作 image由[48,256,256]经过ResUnet会变成[48,512,512]的size 最后和mask做一个loss

我在训练的时候也越大维度不匹配的问题。 dice += (pred[:,i] * target[:,i]).sum(dim=1).sum(dim=1).sum(dim=1) / ((pred[:,i] * target[:,i]).sum(dim=1).sum(dim=1).sum(dim=1)+ RuntimeError: The size of tensor a (512) must match the size of tensor b (256) at non-singleton dimension 3

请问这个解决了吗?我也是遇到了这个问题

有哪位大佬知道这个问题怎么解决
dice += (pred[:,i] * target[:,il)sum(din=l)sum(din=l)sun(din=l) / ((pred[:,i] * target[:,i)sum(din=l)sum(din=l).sumn(din=l)+
RuntimeError: The size of tensor a (1024) must match the size of tensor b (512) at non-sinaleton dimension 3