yjxiong / tsn-pytorch

Temporal Segment Networks (TSN) in PyTorch
BSD 2-Clause "Simplified" License
1.07k stars 308 forks source link

size mismatch error when i loading BNInception #62

Closed Jenniferlyt closed 6 years ago

Jenniferlyt commented 6 years ago

`cv3:~/Mytask/TSN/tsn$ python main.py ucf101 RGB "/home/liyating/Mytask/TSN/tsn/tsn_model_parameters/ucf101_rgb_train_list" "/home/liyating/Mytask/TSN/tsn/tsn_model_parameters/ucf101_rgb_val_list" --arch BNInception --num_segments 3 \

--gd 20 --lr 0.001 --lr_steps 30 60 --epochs 80 \ -b 128 -j 8 --dropout 0.8 \ --snapshot_pref ucf101bninception

Initializing TSN with base model: BNInception. TSN Configurations: input_modality: RGB num_segments: 3 new_length: 1 consensus_module: avg dropout_ratio: 0.8 `

Traceback (most recent call last): File "main.py", line 302, in <module> main() File "main.py", line 35, in main consensus_type=args.consensus_type, dropout=args.dropout, partial_bn=not args.no_partialbn) File "/home/liyating/Mytask/TSN/tsn/models.py", line 39, in __init__ self._prepare_base_model(base_model) File "/home/liyating/Mytask/TSN/tsn/models.py", line 96, in _prepare_base_model self.base_model = getattr(tf_model_zoo, base_model)() File "/home/liyating/Mytask/TSN/tsn/tf_model_zoo/bninception/pytorch_load.py", line 35, in __init__ self.load_state_dict(torch.utils.model_zoo.load_url(weight_url)) File "/home/liyating/anaconda3/lib/python3.6/site-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 BNInception: size mismatch for conv1_7x7_s2_bn.weight: copying a param of torch.Size([64]) from checkpoint, where the shape is torch.Size([1, 64]) in current model. size mismatch for conv1_7x7_s2_bn.bias: copying a param of torch.Size([64]) from checkpoint, where the shape is torch.Size([1, 64]) in current model. size mismatch for conv1_7x7_s2_bn.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 conv1_7x7_s2_bn.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 conv2_3x3_reduce_bn.weight: copying a param of torch.Size([64]) from checkpoint, where the shape is torch.Size([1, 64]) in current model. size mismatch for conv2_3x3_reduce_bn.bias: copying a param of torch.Size([64]) from checkpoint, where the shape is torch.Size([1, 64]) in current model. size mismatch for conv2_3x3_reduce_bn.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 conv2_3x3_reduce_bn.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 conv2_3x3_bn.weight: copying a param of torch.Size([192]) from checkpoint, where the shape is torch.Size([1, 192]) in current model.

Ihave some error ,could someone can help me ? thanks a lot!!!

lisitodyb commented 6 years ago

i have the same error,can you tell me how to fix this? thank you so much!

ccmeteorljh commented 5 years ago

i have the same error,too,can you tell me how to fix this? thank you so much! @Jenniferlyt

Phylake1337 commented 5 years ago

@lisitodyb @ccmeteorljh @Jenniferlyt found that link elsewhere,Ya could check it GL https://github.com/Cadene/pretrained-models.pytorch/issues/70#issuecomment-410479575