Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

维度问题 #33

Open
Thehonst opened this issue Oct 25, 2022 · 6 comments
Open

维度问题 #33

Thehonst opened this issue Oct 25, 2022 · 6 comments

Comments

@Thehonst
Copy link

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
Copy link

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

请问你们解决了吗

@linsan1uz
Copy link

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

@wzh0328
Copy link

wzh0328 commented May 27, 2023

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

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

@yanbin-zhu
Copy link

我也遇到了这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants