fdbtrs / mixfacenets

Official repository for MixFaceNets: Extremely Efficient Face Recognition Networks
MIT License
61 stars 12 forks source link

Errors in loading state_dict for MixNet when trying to run eval.py #9

Open milech opened 6 months ago

milech commented 6 months ago

Running eval.py with 147836backbone.pth, as hardcoded in the eval.py script, for any of the six models (MixFaceNet-M, ShuffleMixFaceNet-M, MixFaceNet-S, ShuffleMixFaceNet-S, MixFaceNet-XS, ShuffleMixFaceNet-XS) throws the following exception:

Exception has occurred: RuntimeError
Error(s) in loading state_dict for MixNet:
    size mismatch for tail.conv.weight: copying a param with shape torch.Size([1024, 200, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 200, 1, 1]).
    size mismatch for tail.bn.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for tail.bn.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for tail.bn.running_mean: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for tail.bn.running_var: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for tail.activ.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for feautre_layer.dw_conv.conv.weight: copying a param with shape torch.Size([1024, 1, 7, 7]) from checkpoint, the shape in current model is torch.Size([512, 1, 7, 7]).
    size mismatch for feautre_layer.dw_conv.bn.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for feautre_layer.dw_conv.bn.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for feautre_layer.dw_conv.bn.running_mean: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for feautre_layer.dw_conv.bn.running_var: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for feautre_layer.pw_conv.conv.weight: copying a param with shape torch.Size([512, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
  File "/user/mlech/codes/mixfacenets/eval.py", line 31, in <module>
    backbone.load_state_dict(torch.load(os.path.join('models','147836backbone.pth'),map_location=torch.device('cpu')))
RuntimeError: Error(s) in loading state_dict for MixNet:
    size mismatch for tail.conv.weight: copying a param with shape torch.Size([1024, 200, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 200, 1, 1]).
    size mismatch for tail.bn.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for tail.bn.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for tail.bn.running_mean: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for tail.bn.running_var: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for tail.activ.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for feautre_layer.dw_conv.conv.weight: copying a param with shape torch.Size([1024, 1, 7, 7]) from checkpoint, the shape in current model is torch.Size([512, 1, 7, 7]).
    size mismatch for feautre_layer.dw_conv.bn.weight: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for feautre_layer.dw_conv.bn.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for feautre_layer.dw_conv.bn.running_mean: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for feautre_layer.dw_conv.bn.running_var: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([512]).
    size mismatch for feautre_layer.pw_conv.conv.weight: copying a param with shape torch.Size([512, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
Heatseeker-3 commented 6 months ago

Have you got any fix for this? I'm having the same issue.

milech commented 5 months ago

Not sure whether you're asking me or the author, I haven't tried to fix that.