Open xiaoiker opened 5 years ago
I have the same question.Do you solve the question?
I have the same question.Do you solve the question?
Finally, I found it. The reason is that the generate_model(opt) function, for any model, default to remove the last FC layer, so you can comment these lines in generate_model(opt), then you will get a accuracy around 86%:
` if not opt.no_cuda: model = model.cuda() model = nn.DataParallel(model, device_ids=None)
if opt.pretrain_path:
print('loading pretrained model {}'.format(opt.pretrain_path))
pretrain = torch.load(opt.pretrain_path)
assert opt.arch == pretrain['arch']
model.load_state_dict(pretrain['state_dict'])
if opt.model == 'densenet':
model.module.classifier = nn.Linear(
model.module.classifier.in_features, opt.n_finetune_classes)
model.module.classifier = model.module.classifier.cuda()
#### comment these 3 lines else: model.module.fc = nn.Linear(model.module.fc.in_features, opt.n_finetune_classes) model.module.fc = model.module.fc.cuda()
parameters = get_fine_tuning_parameters(model, opt.ft_begin_index)
return model, parameters`
I try your solution,but I also get 0 accuracy.And running half of the codes ,it went wrong .Can you tell me your specific steps? Thank you !
Thank you for your steps! I tried as you said,but it went wrong.Can you help me?
loading checkpoint /home/chen/Desktop/UCF/resnet-18-kinetics-ucf101_split1.pth
Traceback (most recent call last):
File "main.py", line 131, in
youre probably trying to run it on your cpu, and the weights were trained on a GPU with dataparallel. you need to erase the module inside the names of the weights.
@xiaoiker @zx1009737297 @cagbal @skamdar Hi, I got the accuracy of val.log, but I want to calculate the accuracy of video level, where can I get the val.json file and how to use eval_ucf101.py?
Hello, I download your pretrained model resnext-101-kinetics-ucf101_split1.pt and want to test it directly on ucf101, But I get 0 accuracy. What should be the problem? Should I still finetuning it before I test?