3DUNet-Pytorch icon indicating copy to clipboard operation
3DUNet-Pytorch copied to clipboard

维度问题

Open Thehonst opened this issue 1 year ago • 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]

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

Thehonst avatar Oct 25 '22 08:10 Thehonst

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

stonedada avatar Nov 22 '22 02:11 stonedada

请问你们解决了吗

XiaoMengLiLiLi avatar Nov 24 '22 02:11 XiaoMengLiLiLi

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

linsan1uz avatar Dec 03 '22 10:12 linsan1uz

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

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

wzh0328 avatar May 27 '23 07:05 wzh0328

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

guli-7721 avatar Jul 19 '23 06:07 guli-7721