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

I met this error when run with my data.

Open bemoregt opened this issue 3 years ago • 11 comments

HI, @lee-zq

I met this error when run with my data.

My data is brain MRI OASIS data (nii file format).

What's wrong to me?

... ) (map1): Sequential( (0): Conv3d(256, 2, kernel_size=(1, 1, 1), stride=(1, 1, 1)) (1): Upsample(scale_factor=(8.0, 8.0, 8.0), mode=trilinear) (2): Softmax(dim=1) ) ) Total number of parameters: 9498744 =======Epoch:1=======lr:0.0001 0%| | 0/3 [00:00<?, ?it/s]torch.Size([2, 1, 48, 128, 128]) torch.Size([2, 48, 128, 128]) 0%| | 0/3 [00:01<?, ?it/s] Traceback (most recent call last): File "/Users/tessor2/3DUNet-Pytorch/train.py", line 94, in train_log = train(model, train_loader, optimizer, loss, args.n_labels, alpha) File "/Users/tessor2/3DUNet-Pytorch/train.py", line 46, in train target = common.to_one_hot_3d(target,n_labels) File "/Users/tessor2/3DUNet-Pytorch/utils/common.py", line 9, in to_one_hot_3d one_hot = torch.zeros(n, n_classes, s, h, w).scatter_(1, tensor.view(n, 1, s, h, w), 1) RuntimeError: index 243 is out of bounds for dimension 1 with size 2 E

Thanks in advance ~

Best, @bemoregt.

bemoregt avatar Aug 10 '21 02:08 bemoregt

same question...

alongGS avatar Nov 04 '21 03:11 alongGS

and i fixed it py checking my segmentation data( finding two label3, but i have not label3), hope help you

alongGS avatar Nov 04 '21 05:11 alongGS

Hi, I have the same question. Did you fixed it?

bastian110 avatar Dec 24 '21 12:12 bastian110

看起来是输入图像的维度不匹配,看下原始mri的数据是不是多期

jielingao avatar Dec 29 '21 11:12 jielingao

网络输入与输出的不匹配是在模型地方就存在了bug,输入256256,但是输出最后一层是512512,希望作者可以看下这里的问题,谢谢

QianLingjun avatar Jan 13 '22 02:01 QianLingjun

网络输入与输出的不匹配是在模型地方就存在了bug,输入256_256,但是输出最后一层是512_512,希望作者可以看下这里的问题,谢谢

上采样那里括号里三个数字都改成和第一个数字一样就行了(8,8,8)这样

xyf9474 avatar Feb 18 '22 12:02 xyf9474

您好,请问您找到解决方法了吗

Betty-J avatar Mar 04 '22 10:03 Betty-J

您好,请问您找到解决方法了吗 类别数超过索引了,在common.py中tensor下面加一行tensor[tensor > 1] =1

life-8079 avatar Mar 16 '22 13:03 life-8079

您好,请问您找到解决方法了吗 类别数超过索引了,在common.py中tensor下面加一行tensor[tensor > 1] =1 好的,谢谢回复

Betty-J avatar Mar 22 '22 08:03 Betty-J

能解释一下吗 我加了这行代码我的tumor_dice一直是0

linsan1uz avatar Dec 04 '22 14:12 linsan1uz

能解释一下吗 我加了这行代码我的tumor_dice一直是0

johnchen99 avatar Jan 06 '23 03:01 johnchen99