Loads checkpoint by http backend from path: https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_8xb32_in1k_20210831-ea4938fc.pth
11/29 17:18:17 - mmengine - WARNING - The model and loaded state dict do not match exactly
size mismatch for conv1.weight: copying a param with shape torch.Size([64, 3, 7, 7]) from checkpoint, the shape in current model is torch.Size([64, 4, 7, 7]).
11/29 17:18:17 - mmengine - INFO -
backbone.conv1.weight - torch.Size([64, 4, 7, 7]):
The value is the same before and after calling `init_weights` of ImageClassifier
11/29 17:18:17 - mmengine - INFO -
backbone.bn1.weight - torch.Size([64]):
PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_8xb32_in1k_20210831-ea4938fc.pth
...
Additional information
The message says size mismatch for conv1.weight: copying a param with shape torch.Size([64, 3, 7, 7]) from checkpoint, the shape in current model is torch.Size([64, 4, 7, 7]). that the 3-channel weight is copied to the 4-channel.
On the other hand, as it says The value is the same before and after callinginit_weightsof ImageClassifier, the loaded weight is not reflected.
I expect conv1.weight copying a param correctly to 4 channel weights.
Hi @okotaku , thanks for your feedback. what is your expected behavior? I can't quite understand the meaning of I expect conv1.weight copying a param correctly to 4 channel weights..
Prerequisite
Environment
mmengine==0.3.2 mmcls==1.0.0rc3
Reproduces the problem - code sample
Reproduces the problem - command or script
None
Reproduces the problem - error message
Additional information
The message says
size mismatch for conv1.weight: copying a param with shape torch.Size([64, 3, 7, 7]) from checkpoint, the shape in current model is torch.Size([64, 4, 7, 7]).
that the 3-channel weight is copied to the 4-channel. On the other hand, as it saysThe value is the same before and after calling
init_weightsof ImageClassifier
, the loaded weight is not reflected.I expect conv1.weight copying a param correctly to 4 channel weights.