lee-zq / 3DUNet-Pytorch

3DUNet implemented with pytorch
484 stars 108 forks source link

维度问题 #33

Open Thehonst opened 1 year ago

Thehonst commented 1 year ago

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]

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

stonedada commented 1 year ago

我在训练的时候也越大维度不匹配的问题。 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

XiaoMengLiLiLi commented 1 year ago

请问你们解决了吗

linsan1uz commented 1 year ago

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

wzh0328 commented 1 year ago

我在训练的时候也越大维度不匹配的问题。 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

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

guli-7721 commented 1 year ago

有哪位大佬知道这个问题怎么解决 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