mmagic icon indicating copy to clipboard operation
mmagic copied to clipboard

gca model missing keys

Open Zenobia7 opened this issue 4 years ago • 12 comments

Hello, thank you very much for the framework you provided. When I used the GCA network training in matting, missing keys in source state_dict appeared. The weight of this backbone model is model_best_resnet34_en_nomixup.pth, Could you please give me a look at what might be the cause? Thank you very much!

Zenobia7 avatar May 14 '21 02:05 Zenobia7

Please provide the full error log.

If the keys are fc, then it is expected.

innerlee avatar May 14 '21 03:05 innerlee

@innerlee missing keys: `size mismatch for conv1.conv.weight_orig: copying a param with shape torch.Size([32, 6, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 4, 3, 3]). size mismatch for conv1.conv.weight_v: copying a param with shape torch.Size([54]) from checkpoint, the shape in current model is torch.Size([36]). unexpected key in source state_dict: layer_bottleneck.0.conv1.module.weight_u, layer_bottleneck.0.conv1.module.weight_v, layer_bottleneck.0.conv1.module.weight_bar, layer_bottleneck.0.bn1.weight, layer_bottleneck.0.bn1.bias, layer_bottleneck.0.bn1.running_mean, layer_bottleneck.0.bn1.running_var, layer_bottleneck.0.bn1.num_batches_tracked, layer_bottleneck.0.conv2.module.weight_u, layer_bottleneck.0.conv2.module.weight_v, layer_bottleneck.0.conv2.module.weight_bar, layer_bottleneck.0.bn2.weight, layer_bottleneck.0.bn2.bias, layer_bottleneck.0.bn2.running_mean, layer_bottleneck.0.bn2.running_var, layer_bottleneck.0.bn2.num_batches_tracked, layer_bottleneck.0.downsample.1.module.weight_u, layer_bottleneck.0.downsample.1.module.weight_v, layer_bottleneck.0.downsample.1.module.weight_bar, layer_bottleneck.0.downsample.2.weight, layer_bottleneck.0.downsample.2.bias, layer_bottleneck.0.downsample.2.running_mean, layer_bottleneck.0.downsample.2.running_var, layer_bottleneck.0.downsample.2.num_batches_tracked, layer_bottleneck.1.conv1.module.weight_u, layer_bottleneck.1.conv1.module.weight_v, layer_bottleneck.1.conv1.module.weight_bar, layer_bottleneck.1.bn1.weight, layer_bottleneck.1.bn1.bias, layer_bottleneck.1.bn1.running_mean, layer_bottleneck.1.bn1.running_var, layer_bottleneck.1.bn1.num_batches_tracked, layer_bottleneck.1.conv2.module.weight_u, layer_bottleneck.1.conv2.module.weight_v, layer_bottleneck.1.conv2.module.weight_bar, layer_bottleneck.1.bn2.weight, layer_bottleneck.1.bn2.bias, layer_bottleneck.1.bn2.running_mean, layer_bottleneck.1.bn2.running_var, layer_bottleneck.1.bn2.num_batches_tracked, layer_bottleneck.2.conv1.module.weight_u, layer_bottleneck.2.conv1.module.weight_v, layer_bottleneck.2.conv1.module.weight_bar, layer_bottleneck.2.bn1.weight, layer_bottleneck.2.bn1.bias, layer_bottleneck.2.bn1.running_mean, layer_bottleneck.2.bn1.running_var, layer_bottleneck.2.bn1.num_batches_tracked, layer_bottleneck.2.conv2.module.weight_u, layer_bottleneck.2.conv2.module.weight_v, layer_bottleneck.2.conv2.module.weight_bar, layer_bottleneck.2.bn2.weight, layer_bottleneck.2.bn2.bias, layer_bottleneck.2.bn2.running_mean, layer_bottleneck.2.bn2.running_var, layer_bottleneck.2.bn2.num_batches_tracked, fc.weight, fc.bias, layer3.4.conv1.conv.weight_u, layer3.4.conv1.conv.weight_v, layer3.4.conv1.conv.weight_orig, layer3.4.conv1.bn.weight, layer3.4.conv1.bn.bias, layer3.4.conv1.bn.running_mean, layer3.4.conv1.bn.running_var, layer3.4.conv1.bn.num_batches_tracked, layer3.4.conv2.conv.weight_u, layer3.4.conv2.conv.weight_v, layer3.4.conv2.conv.weight_orig, layer3.4.conv2.bn.weight, layer3.4.conv2.bn.bias, layer3.4.conv2.bn.running_mean, layer3.4.conv2.bn.running_var, layer3.4.conv2.bn.num_batches_tracked, layer3.5.conv1.conv.weight_u, layer3.5.conv1.conv.weight_v, layer3.5.conv1.conv.weight_orig, layer3.5.conv1.bn.weight, layer3.5.conv1.bn.bias, layer3.5.conv1.bn.running_mean, layer3.5.conv1.bn.running_var, layer3.5.conv1.bn.num_batches_tracked, layer3.5.conv2.conv.weight_u, layer3.5.conv2.conv.weight_v, layer3.5.conv2.conv.weight_orig, layer3.5.conv2.bn.weight, layer3.5.conv2.bn.bias, layer3.5.conv2.bn.running_mean, layer3.5.conv2.bn.running_var, layer3.5.conv2.bn.num_batches_tracked

missing keys in source state_dict: layer4.0.conv1.conv.weight_orig, layer4.0.conv1.conv.weight, layer4.0.conv1.conv.weight_u, layer4.0.conv1.conv.weight_orig, layer4.0.conv1.conv.weight_u, layer4.0.conv1.conv.weight_v, layer4.0.conv1.bn.weight, layer4.0.conv1.bn.bias, layer4.0.conv1.bn.running_mean, layer4.0.conv1.bn.running_var, layer4.0.conv2.conv.weight_orig, layer4.0.conv2.conv.weight, layer4.0.conv2.conv.weight_u, layer4.0.conv2.conv.weight_orig, layer4.0.conv2.conv.weight_u, layer4.0.conv2.conv.weight_v, layer4.0.conv2.bn.weight, layer4.0.conv2.bn.bias, layer4.0.conv2.bn.running_mean, layer4.0.conv2.bn.running_var, layer4.0.interpolation.1.conv.weight_orig, layer4.0.interpolation.1.conv.weight, layer4.0.interpolation.1.conv.weight_u, layer4.0.interpolation.1.conv.weight_orig, layer4.0.interpolation.1.conv.weight_u, layer4.0.interpolation.1.conv.weight_v, layer4.0.interpolation.1.bn.weight, layer4.0.interpolation.1.bn.bias, layer4.0.interpolation.1.bn.running_mean, layer4.0.interpolation.1.bn.running_var, layer4.1.conv1.conv.weight_orig, layer4.1.conv1.conv.weight, layer4.1.conv1.conv.weight_u, layer4.1.conv1.conv.weight_orig, layer4.1.conv1.conv.weight_u, layer4.1.conv1.conv.weight_v, layer4.1.conv1.bn.weight, layer4.1.conv1.bn.bias, layer4.1.conv1.bn.running_mean, layer4.1.conv1.bn.running_var, layer4.1.conv2.conv.weight_orig, layer4.1.conv2.conv.weight, layer4.1.conv2.conv.weight_u, layer4.1.conv2.conv.weight_orig, layer4.1.conv2.conv.weight_u, layer4.1.conv2.conv.weight_v, layer4.1.conv2.bn.weight, layer4.1.conv2.bn.bias, layer4.1.conv2.bn.running_mean, layer4.1.conv2.bn.running_var, shortcut.0.0.conv.weight_orig, shortcut.0.0.conv.weight, shortcut.0.0.conv.weight_u, shortcut.0.0.conv.weight_orig, shortcut.0.0.conv.weight_u, shortcut.0.0.conv.weight_v, shortcut.0.0.bn.weight, shortcut.0.0.bn.bias, shortcut.0.0.bn.running_mean, shortcut.0.0.bn.running_var, shortcut.0.1.conv.weight_orig, shortcut.0.1.conv.weight, shortcut.0.1.conv.weight_u, shortcut.0.1.conv.weight_orig, shortcut.0.1.conv.weight_u, shortcut.0.1.conv.weight_v, shortcut.0.1.bn.weight, shortcut.0.1.bn.bias, shortcut.0.1.bn.running_mean, shortcut.0.1.bn.running_var, shortcut.1.0.conv.weight_orig, shortcut.1.0.conv.weight, shortcut.1.0.conv.weight_u, shortcut.1.0.conv.weight_orig, shortcut.1.0.conv.weight_u, shortcut.1.0.conv.weight_v, shortcut.1.0.bn.weight, shortcut.1.0.bn.bias, shortcut.1.0.bn.running_mean, shortcut.1.0.bn.running_var, shortcut.1.1.conv.weight_orig, shortcut.1.1.conv.weight, shortcut.1.1.conv.weight_u, shortcut.1.1.conv.weight_orig, shortcut.1.1.conv.weight_u, shortcut.1.1.conv.weight_v, shortcut.1.1.bn.weight, shortcut.1.1.bn.bias, shortcut.1.1.bn.running_mean, shortcut.1.1.bn.running_var, shortcut.2.0.conv.weight_orig, shortcut.2.0.conv.weight, shortcut.2.0.conv.weight_u, shortcut.2.0.conv.weight_orig, shortcut.2.0.conv.weight_u, shortcut.2.0.conv.weight_v, shortcut.2.0.bn.weight, shortcut.2.0.bn.bias, shortcut.2.0.bn.running_mean, shortcut.2.0.bn.running_var, shortcut.2.1.conv.weight_orig, shortcut.2.1.conv.weight, shortcut.2.1.conv.weight_u, shortcut.2.1.conv.weight_orig, shortcut.2.1.conv.weight_u, shortcut.2.1.conv.weight_v, shortcut.2.1.bn.weight, shortcut.2.1.bn.bias, shortcut.2.1.bn.running_mean, shortcut.2.1.bn.running_var, shortcut.3.0.conv.weight_orig, shortcut.3.0.conv.weight, shortcut.3.0.conv.weight_u, shortcut.3.0.conv.weight_orig, shortcut.3.0.conv.weight_u, shortcut.3.0.conv.weight_v, shortcut.3.0.bn.weight, shortcut.3.0.bn.bias, shortcut.3.0.bn.running_mean, shortcut.3.0.bn.running_var, shortcut.3.1.conv.weight_orig, shortcut.3.1.conv.weight, shortcut.3.1.conv.weight_u, shortcut.3.1.conv.weight_orig, shortcut.3.1.conv.weight_u, shortcut.3.1.conv.weight_v, shortcut.3.1.bn.weight, shortcut.3.1.bn.bias, shortcut.3.1.bn.running_mean, shortcut.3.1.bn.running_var, shortcut.4.0.conv.weight_orig, shortcut.4.0.conv.weight, shortcut.4.0.conv.weight_u, shortcut.4.0.conv.weight_orig, shortcut.4.0.conv.weight_u, shortcut.4.0.conv.weight_v, shortcut.4.0.bn.weight, shortcut.4.0.bn.bias, shortcut.4.0.bn.running_mean, shortcut.4.0.bn.running_var, shortcut.4.1.conv.weight_orig, shortcut.4.1.conv.weight, shortcut.4.1.conv.weight_u, shortcut.4.1.conv.weight_orig, shortcut.4.1.conv.weight_u, shortcut.4.1.conv.weight_v, shortcut.4.1.bn.weight, shortcut.4.1.bn.bias, shortcut.4.1.bn.running_mean, shortcut.4.1.bn.running_var, guidance_head.0.conv.weight_orig, guidance_head.0.conv.weight, guidance_head.0.conv.weight_u, guidance_head.0.conv.weight_orig, guidance_head.0.conv.weight_u, guidance_head.0.conv.weight_v, guidance_head.0.bn.weight, guidance_head.0.bn.bias, guidance_head.0.bn.running_mean, guidance_head.0.bn.running_var, guidance_head.1.conv.weight_orig, guidance_head.1.conv.weight, guidance_head.1.conv.weight_u, guidance_head.1.conv.weight_orig, guidance_head.1.conv.weight_u, guidance_head.1.conv.weight_v, guidance_head.1.bn.weight, guidance_head.1.bn.bias, guidance_head.1.bn.running_mean, guidance_head.1.bn.running_var, guidance_head.2.conv.weight_orig, guidance_head.2.conv.weight, guidance_head.2.conv.weight_u, guidance_head.2.conv.weight_orig, guidance_head.2.conv.weight_u, guidance_head.2.conv.weight_v, guidance_head.2.bn.weight, guidance_head.2.bn.bias, guidance_head.2.bn.running_mean, guidance_head.2.bn.running_var, gca.guidance_conv.weight, gca.guidance_conv.bias, gca.out_conv.conv.weight, gca.out_conv.bn.weight, gca.out_conv.bn.bias, gca.out_conv.bn.running_mean, gca.out_conv.bn.running_var`

Zenobia7 avatar May 14 '21 07:05 Zenobia7

Hi, @15122901359. Where is the pretrained weight model_best_resnet34_en_nomixup.pth from?

hejm37 avatar May 14 '21 09:05 hejm37

I've met the same problem, and I download the pretrained model 'model_best_resnet34_en_nomixup.pth' from https://github.com/open-mmlab/mmcv/blob/b4bfeb53c5/mmcv/model_zoo/open_mmlab.json

Dinghow avatar Sep 11 '21 06:09 Dinghow

Thank you @Dinghow for your information! I've checked with the pretrained weight provided by the json file. The pretrained weight file is outdated.

We will update the latest pretrained weight as soon as possible. Thank you!

hejm37 avatar Sep 11 '21 19:09 hejm37

Thank you for your work @hejm37, how soon will the latest pre-trained weight be updated?

yuchengtianxia avatar Oct 28 '21 15:10 yuchengtianxia

Hi @yuchengtianxia, I am not sure about the exact date, but I guess we will probably update it in the next two weeks.

hejm37 avatar Nov 03 '21 06:11 hejm37

The pretrained weight is now updated.

hejm37 avatar Nov 14 '21 08:11 hejm37

Hi @hejm37, Thank you for your work! I trained the GCA network with the updated pretrained weights (https://github.com/open-mmlab/mmcv/blob/b4bfeb53c5/mmcv/model_zoo/open_mmlab.json), but missing keys still appeared. The log shows: WARNING - The model and loaded state dict do not match exactly

size mismatch for layer4.0.conv1.conv.weight_orig: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 256, 3, 3]). size mismatch for layer4.0.conv1.conv.weight_u: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.conv1.bn.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.conv1.bn.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.conv1.bn.running_mean: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.conv1.bn.running_var: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.conv2.conv.weight_orig: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for layer4.0.conv2.conv.weight_u: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.conv2.conv.weight_v: copying a param with shape torch.Size([2304]) from checkpoint, the shape in current model is torch.Size([4608]). size mismatch for layer4.0.conv2.bn.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.conv2.bn.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.conv2.bn.running_mean: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.conv2.bn.running_var: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.interpolation.1.conv.weight_orig: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 256, 1, 1]). size mismatch for layer4.0.interpolation.1.conv.weight_u: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.interpolation.1.conv.weight_v: copying a param with shape torch.Size([2304]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for layer4.0.interpolation.1.bn.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.interpolation.1.bn.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.interpolation.1.bn.running_mean: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.0.interpolation.1.bn.running_var: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.1.conv1.conv.weight_orig: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for layer4.1.conv1.conv.weight_u: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.1.conv1.conv.weight_v: copying a param with shape torch.Size([2304]) from checkpoint, the shape in current model is torch.Size([4608]). size mismatch for layer4.1.conv1.bn.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.1.conv1.bn.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.1.conv1.bn.running_mean: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.1.conv1.bn.running_var: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for layer4.1.conv2.conv.weight_orig: copying a param with shape torch.Size([512, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for layer4.1.conv2.conv.weight_v: copying a param with shape torch.Size([2304]) from checkpoint, the shape in current model is torch.Size([4608]). size mismatch for shortcut.0.0.conv.weight_orig: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 6, 3, 3]). size mismatch for shortcut.0.0.conv.weight_u: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.0.0.conv.weight_v: copying a param with shape torch.Size([4608]) from checkpoint, the shape in current model is torch.Size([54]). size mismatch for shortcut.0.0.bn.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.0.0.bn.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.0.0.bn.running_mean: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.0.0.bn.running_var: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.0.1.conv.weight_orig: copying a param with shape torch.Size([512, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([32, 32, 3, 3]). size mismatch for shortcut.0.1.conv.weight_u: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.0.1.conv.weight_v: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([288]). size mismatch for shortcut.0.1.bn.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.0.1.bn.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.0.1.bn.running_mean: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.0.1.bn.running_var: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.1.0.conv.weight_orig: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 32, 3, 3]). size mismatch for shortcut.1.0.conv.weight_u: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.1.0.conv.weight_v: copying a param with shape torch.Size([4608]) from checkpoint, the shape in current model is torch.Size([288]). size mismatch for shortcut.1.0.bn.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.1.0.bn.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.1.0.bn.running_mean: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.1.0.bn.running_var: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.1.1.conv.weight_orig: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 32, 3, 3]). size mismatch for shortcut.1.1.conv.weight_u: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.1.1.conv.weight_v: copying a param with shape torch.Size([4608]) from checkpoint, the shape in current model is torch.Size([288]). size mismatch for shortcut.1.1.bn.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.1.1.bn.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.1.1.bn.running_mean: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.1.1.bn.running_var: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for shortcut.2.0.conv.weight_orig: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 64, 3, 3]). size mismatch for shortcut.2.0.conv.weight_u: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for shortcut.2.0.conv.weight_v: copying a param with shape torch.Size([4608]) from checkpoint, the shape in current model is torch.Size([576]). size mismatch for shortcut.2.0.bn.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for shortcut.2.0.bn.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for shortcut.2.0.bn.running_mean: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for shortcut.2.0.bn.running_var: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for shortcut.2.1.conv.weight_orig: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 64, 3, 3]). size mismatch for shortcut.2.1.conv.weight_u: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for shortcut.2.1.conv.weight_v: copying a param with shape torch.Size([4608]) from checkpoint, the shape in current model is torch.Size([576]). size mismatch for shortcut.2.1.bn.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for shortcut.2.1.bn.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for shortcut.2.1.bn.running_mean: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for shortcut.2.1.bn.running_var: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([64]). unexpected key in source state_dict: fc.weight, fc.bias

missing keys in source state_dict: shortcut.3.0.conv.weight_orig, shortcut.3.0.conv.weight, shortcut.3.0.conv.weight_u, shortcut.3.0.conv.weight_orig, shortcut.3.0.conv.weight_u, shortcut.3.0.conv.weight_v, shortcut.3.0.bn.weight, shortcut.3.0.bn.bias, shortcut.3.0.bn.running_mean, shortcut.3.0.bn.running_var, shortcut.3.1.conv.weight_orig, shortcut.3.1.conv.weight, shortcut.3.1.conv.weight_u, shortcut.3.1.conv.weight_orig, shortcut.3.1.conv.weight_u, shortcut.3.1.conv.weight_v, shortcut.3.1.bn.weight, shortcut.3.1.bn.bias, shortcut.3.1.bn.running_mean, shortcut.3.1.bn.running_var, shortcut.4.0.conv.weight_orig, shortcut.4.0.conv.weight, shortcut.4.0.conv.weight_u, shortcut.4.0.conv.weight_orig, shortcut.4.0.conv.weight_u, shortcut.4.0.conv.weight_v, shortcut.4.0.bn.weight, shortcut.4.0.bn.bias, shortcut.4.0.bn.running_mean, shortcut.4.0.bn.running_var, shortcut.4.1.conv.weight_orig, shortcut.4.1.conv.weight, shortcut.4.1.conv.weight_u, shortcut.4.1.conv.weight_orig, shortcut.4.1.conv.weight_u, shortcut.4.1.conv.weight_v, shortcut.4.1.bn.weight, shortcut.4.1.bn.bias, shortcut.4.1.bn.running_mean, shortcut.4.1.bn.running_var, guidance_head.0.conv.weight_orig, guidance_head.0.conv.weight, guidance_head.0.conv.weight_u, guidance_head.0.conv.weight_orig, guidance_head.0.conv.weight_u, guidance_head.0.conv.weight_v, guidance_head.0.bn.weight, guidance_head.0.bn.bias, guidance_head.0.bn.running_mean, guidance_head.0.bn.running_var, guidance_head.1.conv.weight_orig, guidance_head.1.conv.weight, guidance_head.1.conv.weight_u, guidance_head.1.conv.weight_orig, guidance_head.1.conv.weight_u, guidance_head.1.conv.weight_v, guidance_head.1.bn.weight, guidance_head.1.bn.bias, guidance_head.1.bn.running_mean, guidance_head.1.bn.running_var, guidance_head.2.conv.weight_orig, guidance_head.2.conv.weight, guidance_head.2.conv.weight_u, guidance_head.2.conv.weight_orig, guidance_head.2.conv.weight_u, guidance_head.2.conv.weight_v, guidance_head.2.bn.weight, guidance_head.2.bn.bias, guidance_head.2.bn.running_mean, guidance_head.2.bn.running_var, gca.guidance_conv.weight, gca.guidance_conv.bias, gca.out_conv.conv.weight, gca.out_conv.bn.weight, gca.out_conv.bn.bias, gca.out_conv.bn.running_mean, gca.out_conv.bn.running_var

ailsaim avatar Nov 22 '21 08:11 ailsaim

It's normal to have those missing keys since only partial weights of the encoder are from pretrained weights.

But it's abnormal that there are size mismatches. Are you using the default config from https://github.com/open-mmlab/mmediting/blob/master/configs/mattors/gca/gca_r34_4x10_200k_comp1k.py?

hejm37 avatar Nov 27 '21 07:11 hejm37

@hejm37 I only changed "bg_dir = './data/coco/train2017'" in the default config to "bg_dir = './data/coco/train2014'", and other settings remain unchanged. I think the bg_dir setting has nothing to do with the model structure, but the error of size mismatches still exist.

ailsaim avatar Dec 10 '21 01:12 ailsaim

Hi @hejm37, I also met the problem of mismatch between the model and the pre-trained weight, The log shows: "The model and loaded state dict do not match exactly". The pre-trained weight did not work.

yuchengtianxia avatar Feb 21 '22 08:02 yuchengtianxia

@LeoXing1996 Please check this issue.

zengyh1900 avatar Oct 09 '22 09:10 zengyh1900

Hey @yuchengtianxia , can you provide the URL of the checkpoint you used?

LeoXing1996 avatar Oct 14 '22 09:10 LeoXing1996

Closing due to inactivity, please reopen if there are any further problems.

zengyh1900 avatar Oct 25 '22 06:10 zengyh1900