i have some problem do a test
See original GitHub issueI would like to test network on UCF101 after finetune in UCF101 using pretrained kinetics you provided.
i use resnet18. I want to get the accuracy of a video unit, not clip.
i use instruction below
python main.py --root_path UCF101 --video_path jpg --annotation_path ucf101_01.json --result_path test --dataset ucf101 --model resnet --model_depth 18 --n_classes 101 --batch_size 64 --n_threads 4 --pretrain_path 18result1s/save_200.pth --no_train --no_val --test --test_subset val --n_finetune_classes 101
jpg is the same as your data directory. 18results1s/save_200.pth is pretrained on Kinetics, finetune in UCF101’s network.
it make a error.
run
dataset loading [0/3783]
dataset loading [1000/3783]
dataset loading [2000/3783]
dataset loading [3000/3783]
test
test.py:42: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad():
instead.
inputs = Variable(inputs, volatile=True)
test.py:45: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
outputs = F.softmax(outputs)
Traceback (most recent call last):
File “main.py”, line 162, in <module>
test.test(test_loader, model, opt, test_data.class_names)
File “test.py”, line 50, in test
test_results, class_names)
File “test.py”, line 20, in calculate_video_results
‘label’: class_names[locs[i]],
KeyError: tensor(12)
KeyError : tensor(12) , i change my instruction, the number in parentheses is change, maybe.
can you help me?
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (1 by maintainers)
Top GitHub Comments
@lee2h Hope this should help you similar kind of error i got please try in this way that is zero tensor error
video_results = [] for i in range(sorted_scores.size(0)): video_results.append({ ‘label’: class_names[torch.Tensor.item(locs[i])], ‘score’: float(sorted_scores[i]) })
in command, i change pretrain_path to resume_path, it works well. i get UCF101 split 1, 82.2% video accuracy.
i will train and evaluate for another split and pytorch 0.5. if there is no problem, i will close this issue.
thank you for your awesome work.