Несоответствие размеров при тестировании предварительно обученной модели TRN-Pytorch - PullRequest
0 голосов
/ 11 марта 2019

Я пытался обнаружить распознавание действий, используя модель TRN-Pytorch.Я ссылался на эту ссылку .Я использую 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.
...