lee-zq/3DUNet-Pytorch

I met this error when run with my data.

Opened this issue · 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.

same question...

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

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

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

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

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

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

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

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

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

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

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