测试TRN-Pytorch预训练模型时尺寸不匹配

时间:2019-03-11 08:10:17

标签: github action pytorch

我尝试使用TRN-Pytorch模型检测动作识别。我提到了this link。运行此代码进行测试时,我使用的是pytorch 0.4.1

python3 test_video.py --arch InceptionV3 --dataset moments \
    --weights pretrain/TRN_moments_RGB_InceptionV3_TRNmultiscale_segment8_best.pth.tar \
    --frame_folder sample_data/juggling_frames 

我收到此错误

Traceback (most recent call last):
  File "test_video.py", line 105, in <module>
    img_feature_dim=args.img_feature_dim, print_spec=False)
  File "/content/drive/My Drive/TRN-pytorch/models.py", line 43, in __init__
    self._prepare_base_model(base_model)
  File "/content/drive/My Drive/TRN-pytorch/models.py", line 120, in _prepare_base_model
    self.base_model = getattr(model_zoo, base_model)()
  File "/content/drive/My Drive/TRN-pytorch/model_zoo/bninception/pytorch_load.py", line 67, in __init__
    super(InceptionV3, self).__init__(model_path=model_path, weight_url=weight_url, num_classes=num_classes)
  File "/content/drive/My Drive/TRN-pytorch/model_zoo/bninception/pytorch_load.py", line 35, in __init__
    self.load_state_dict(torch.utils.model_zoo.load_url(weight_url))
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 719, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for InceptionV3:
    size mismatch for conv_batchnorm.weight: copying a param of torch.Size([32]) from checkpoint, where the shape is torch.Size([1, 32]) in current model.
    size mismatch for conv_batchnorm.bias: copying a param of torch.Size([32]) from checkpoint, where the shape is torch.Size([1, 32]) in current model.
    size mismatch for conv_batchnorm.running_mean: copying a param of torch.Size([32]) from checkpoint, where the shape is torch.Size([1, 32]) in current model.
    size mismatch for conv_batchnorm.running_var: copying a param of torch.Size([32]) from checkpoint, where the shape is torch.Size([1, 32]) in current model.
    size mismatch for conv_1_batchnorm.weight: copying a param of torch.Size([32]) from checkpoint, where the shape is torch.Size([1, 32]) in current model.
    size mismatch for conv_1_batchnorm.bias: copying a param of torch.Size([32]) from checkpoint, where the shape is torch.Size([1, 32]) in current model.
    size mismatch for conv_1_batchnorm.running_mean: copying a param of torch.Size([32]) from checkpoint, where the shape is torch.Size([1, 32]) in current model.
    size mismatch for conv_1_batchnorm.running_var: copying a param of torch.Size([32]) from checkpoint, where the shape is torch.Size([1, 32]) in current model.
    size mismatch for conv_2_batchnorm.weight: copying a param of torch.Size([64]) from checkpoint, where the shape is torch.Size([1, 64]) in current model.
    size mismatch for conv_2_batchnorm.bias: copying a param of torch.Size([64]) from checkpoint, where the shape is torch.Size([1, 64]) in current model.
    size mismatch for conv_2_batchnorm.running_mean: copying a param of torch.Size([64]) from checkpoint, where the shape is torch.Size([1, 64]) in current model.
    size mismatch for conv_2_batchnorm.running_var: copying a param of torch.Size([64]) from checkpoint, where the shape is torch.Size([1, 64]) in current model.
    size mismatch for conv_3_batchnorm.weight: copying a param of torch.Size([80]) from checkpoint, where the shape is torch.Size([1, 80]) in current model.
    size mismatch for conv_3_batchnorm.bias: copying a param of torch.Size([80]) from checkpoint, where the shape is torch.Size([1, 80]) in current model.
    size mismatch for conv_3_batchnorm.running_mean: copying a param of torch.Size([80]) from checkpoint, where the shape is torch.Size([1, 80]) in current model.
    size mismatch for conv_3_batchnorm.running_var: copying a param of torch.Size([80]) from checkpoint, where the shape is torch.Size([1, 80]) in current model.
    size mismatch for conv_4_batchnorm.weight: copying a param of torch.Size([192]) from checkpoint, where the shape is torch.Size([1, 192]) in current model.

0 个答案:

没有答案