Traceback (most recent call last):
File "D:/Download/3DUNet-Pytorch-master/dataset/dataset_lits.py", line 65, in
main()
File "D:/Download/3DUNet-Pytorch-master/dataset/dataset_lits.py", line 57, in main
target = to_one_hot_3d(target.long())
File "D:\Download\3DUNet-Pytorch-master\utils\common.py", line 28, 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: Invalid index in scatter at ..\aten\src\TH/generic/THTensorEvenMoreMath.cpp:551
你好,我用你的网盘数据可以训练测试,但是用我自己的CT数据、分割数据,到这一步就卡住报错了: fixd_path = r'D:\Download\3DUNet-Pytorch-master\fixed_data' dataset = Lits_DataSet([16, 64, 64],0.5,fixd_path,mode='train') #batch size data_loader=DataLoader(dataset=dataset,batch_size=2,num_workers=1, shuffle=True) for batch_idx, (data, target) in enumerate(data_loader): print("最大值:") print(torch.max(target.long() , 0)) print(data.shape, target.shape) target = to_one_hot_3d(target.long())
到to_one_hot_3d()函数里的scatter时报错 torch.Size([2, 1, 16, 64, 64]) torch.Size([2, 16, 64, 64])
Traceback (most recent call last): File "D:/Download/3DUNet-Pytorch-master/dataset/dataset_lits.py", line 65, in
main()
File "D:/Download/3DUNet-Pytorch-master/dataset/dataset_lits.py", line 57, in main
target = to_one_hot_3d(target.long())
File "D:\Download\3DUNet-Pytorch-master\utils\common.py", line 28, 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: Invalid index in scatter at ..\aten\src\TH/generic/THTensorEvenMoreMath.cpp:551