-
Notifications
You must be signed in to change notification settings - Fork 112
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
應用在做多類別分割,請問我該如何修改程式 #27
Comments
解决了吗老哥 |
後來改用pytorch提供的指令 target = torch.nn.functional.one_hot(target,n_labels) |
对!我也是这个错误。这一行代码没有理解,不知道咋修改。 |
同问 |
87类考虑背景了吗 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如題,我目前是匯入腦影像與分割結果(class=87),我目前只有修改config.py中
parser.add_argument('--n_labels', type=int, default=87,help='number of classes')
若要開始訓練則會出現以下錯誤
File "train.py", line 89, in <module> train_log = train(model, train_loader, optimizer, loss, args.n_labels, alpha) File "train.py", line 43, in train target = common.to_one_hot_3d(target,n_labels) File "/home/ma/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 87 is out of bounds for dimension 1 with size 87
The text was updated successfully, but these errors were encountered: