kenshohara / 3D-ResNets-PyTorch

3D ResNets for Action Recognition (CVPR 2018)
MIT License
3.91k stars 933 forks source link

Directly test custom dataset using pretrained model #197

Open Fazlik995 opened 4 years ago

Fazlik995 commented 4 years ago

Hi!

Can I directly test my custom dataset on pretrianed model?

My console shows below error:

run target_transform; <target_transforms.VideoID object at 0x7f8fd1f57898> dataset loading [0/3783] dataset loading [1000/3783] dataset loading [2000/3783] dataset loading [3000/3783] test /home/fazlik/Desktop/3D-ResNets-PyTorch/test.py:41: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. inputs = Variable(inputs, volatile=True) /home/fazlik/Desktop/3D-ResNets-PyTorch/test.py:49: 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 181, in test.test(test_loader, model, opt, test_data.class_names) File "/home/fazlik/Desktop/3D-ResNets-PyTorch/test.py", line 54, in test test_results, class_names) File "/home/fazlik/Desktop/3D-ResNets-PyTorch/test.py", line 19, in calculate_video_results 'label': class_names[locs[i].item()], KeyError: 2037

How can I deal with that issue?

Thank you

spoorgholi74 commented 4 years ago

Hi, maybe try class_names[locs[i]..cou().item()]