lee-zq / 3DUNet-Pytorch

3DUNet implemented with pytorch
484 stars 108 forks source link

I met this error when run with my data. #22

Open bemoregt opened 3 years ago

bemoregt commented 3 years ago

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, nclasses, 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.

alongGS commented 2 years ago

same question...

alongGS commented 2 years ago

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

bastian110 commented 2 years ago

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

jielingao commented 2 years ago

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

QianLingjun commented 2 years ago

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

xyf9474 commented 2 years ago

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

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

Betty-J commented 2 years ago

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

life-8079 commented 2 years ago

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

Betty-J commented 2 years ago

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

linsan1uz commented 1 year ago

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

johnchen99 commented 1 year ago

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