Closed Ailce8862 closed 5 years ago
Hello,I'v met the same error,could you tell me how you fixed it?
I tried to change the linecat = seg_label_to_cat[target[b, 0]]
in the following ways.
1.Firstly, I change it to cat = seg_label_to_cat[target[b, 0].numpy()]
or cat = seg_label_to_cat[target[b, 0].numpy()[0]]
, I met :TypeError:unhashable type:'numpy.ndarray'
.
2.And also, I change it to cat = seg_label_to_cat[target[b,0].item()]
or cat = seg_label_to_cat[target.numpy()[b][0]]
. In both situation, the code can run ,but the IOU of several category remains zero.
I very want to know your solution,waiting for your suggetion and answer.Thank you!
I used pytorch 0.3
梁攀 | |
---|---|
邮箱:liangxiaopan8862@126.com |
签名由 网易邮箱大师 定制
On 12/30/2019 09:57, Anniessq wrote:
Hello,I'v met the same error,could you tell me how you fixed it?
I tried to change the line cat = seg_label_to_cat[target[b, 0]] in the following ways. 1.Firstly, I change it to cat = seg_label_to_cat[target[b, 0].numpy()] or cat = seg_label_to_cat[target[b, 0].numpy()[0]] , I met :TypeError:unhashable type:'numpy.ndarray'. 2.And also, I change it to cat = seg_label_to_cat[target[b,0].item()] or cat = seg_label_to_cat[target.numpy()[b][0]]. In both situation, the code can run ,but the IOU of several category remains zero. I very want to know your solution,waiting for your suggetion and answer.Thank you!
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.
Thank you, but cuda 10 can't support pytorch 0.3 and Ubuntu 18.0 can only support cuda10
You can try anaconda.I also use cuda10
梁攀 | |
---|---|
邮箱:liangxiaopan8862@126.com |
签名由 网易邮箱大师 定制
On 12/30/2019 16:43, Anniessq wrote:
Thank you, but cuda 10 can't support pytorch 0.3 and Ubuntu 18.0 can only support cuda10
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.
It's been long time, but i figure it out.
i changed (at 167)
cat = seg_label_to_cat[target[b, 0]] to cat = seg_label_to_cat[target[b, 0].item()]
And i changed (at 174)
cat = seg_label_to_cat[segl[0]] to cat = seg_label_to_cat[segl[0].item()]
this works for me.
[epoch 1: 0/499] train loss: 4.879579 lr: 0.00100 [epoch 1: 20/499] train loss: 1.237031 lr: 0.00100 [epoch 1: 40/499] train loss: 0.955243 lr: 0.00100 [epoch 1: 60/499] train loss: 0.735887 lr: 0.00100 [epoch 1: 80/499] train loss: 0.685161 lr: 0.00100 [epoch 1: 100/499] train loss: 0.482436 lr: 0.00100 [epoch 1: 120/499] train loss: 0.854511 lr: 0.00100 [epoch 1: 140/499] train loss: 0.695081 lr: 0.00100 [epoch 1: 160/499] train loss: 0.860770 lr: 0.00100 [epoch 1: 180/499] train loss: 0.354899 lr: 0.00100 [epoch 1: 200/499] train loss: 0.505713 lr: 0.00100 [epoch 1: 220/499] train loss: 0.378871 lr: 0.00100 [epoch 1: 240/499] train loss: 0.411512 lr: 0.00100 [epoch 1: 260/499] train loss: 0.565703 lr: 0.00100 [epoch 1: 280/499] train loss: 0.386525 lr: 0.00100 [epoch 1: 300/499] train loss: 0.400440 lr: 0.00100 [epoch 1: 320/499] train loss: 0.352148 lr: 0.00100 [epoch 1: 340/499] train loss: 0.571778 lr: 0.00100 train_partseg.py:155: UserWarning: volatile was removed and now has no effect. Use
main()
File "train_partseg.py", line 95, in main
train(train_dataloader, test_dataloader, model, criterion, optimizer, lr_scheduler, bnm_scheduler, args, num_batch)
File "train_partseg.py", line 138, in train
validate(test_dataloader, model, criterion, args, batch_count)
File "train_partseg.py", line 172, in validate
cat = seg_label_to_cat[target[b, 0]]
KeyError: tensor(5)
with torch.no_grad():
instead. points, target = Variable(points, volatile=True), Variable(target, volatile=True) Traceback (most recent call last): File "train_partseg.py", line 214, in