missing keys for mobilenet v3-large?
ktaebum opened this issue · comments
Hello!
First of all, thanks for your great implementation of MobileNetV3
However, when I try to use your pretrained model (large model),
it raises error as
RuntimeError: Error(s) in loading state_dict for MobileNetV3:
Missing key(s) in state_dict: "classifier.0.weight", "classifier.0.bias", "classifier.3.weight", "classifier.3.bias".
Unexpected key(s) in state_dict: "classifier.1.weight", "classifier.1.bias", "classifier.5.weight", "classifier.5.bias".
Is there any difference between current implementation and pretrained checkpoint?
I'm getting the same error.
the same error
I got the same error and tried to assign them manually. Looks like it works, but I don't know if this is the right approach...
state_dict = torch.load('pretrained/mobilenetv3-large-657e7b3d.pth')
state_dict["classifier.0.weight"] = state_dict["classifier.1.weight"]
del state_dict["classifier.1.weight"]
state_dict["classifier.0.bias"] = state_dict["classifier.1.bias"]
del state_dict["classifier.1.bias"]
state_dict["classifier.3.weight"] = state_dict["classifier.5.weight"]
del state_dict["classifier.5.weight"]
state_dict["classifier.3.bias"] = state_dict["classifier.5.bias"]
del state_dict["classifier.5.bias"]
net_large.load_state_dict(
# torch.load('pretrained/mobilenetv3-large-657e7b3d.pth')
state_dict
)
same error, I think maybe due to different pytorch versions.
@d-li14 could you share the version of pytorch that you were using?
the same error, please update the given pth file. Thank you.
The up-to-date release provides bug-free and stronger models now.