eriklindernoren / Action-Recognition

Exploration of different solutions to action recognition in video, using neural networks implemented in PyTorch.
183 stars 74 forks source link

size mismatch for output_layers.3.bias: copying a param with shape torch.Size([101]) from checkpoint, the shape in current model is torch.Size([105]). #20

Open ironfactory8684 opened 4 years ago

ironfactory8684 commented 4 years ago

I get this error when I run test_on_video.py file.


RuntimeError Traceback (most recent call last)

in () ----> 1 model.load_state_dict(torch.load(checkpoint_model)) 2 model.eval() ~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict) 828 if len(error_msgs) > 0: 829 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( --> 830 self.__class__.__name__, "\n\t".join(error_msgs))) 831 return _IncompatibleKeys(missing_keys, unexpected_keys) 832 RuntimeError: Error(s) in loading state_dict for ConvLSTM: size mismatch for output_layers.3.weight: copying a param with shape torch.Size([101, 1024]) from checkpoint, the shape in current model is torch.Size([105, 1024]). size mismatch for output_layers.3.bias: copying a param with shape torch.Size([101]) from checkpoint, the shape in current model is torch.Size([105]).
tonhathuy commented 4 years ago

It's working for me model.load_state_dict(torch.load(opt.checkpoint_model,map_location=device),strict=False)