question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

missing keys for mobilenet v3-large?

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
d-li14commented, Mar 16, 2020

@sngyo provides the right workaround, also refer to #2. However, I will update the network structure and pre-trained models according to the revised MobileNetV3 paper soon. Stay tuned.

2reactions
sngyocommented, Jan 9, 2020

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
)  
Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing keys & unexpected keys in state_dict when loading ...
Hi, there: I've encountered this problem and got stucked for a while. I have a labeled image dataset in a considerable large scale...
Read more >
Searching for MobileNetV3 - CVF Open Access
This paper starts the exploration of how automated search algorithms and net- work design can work together to harness complementary approaches improving the ......
Read more >
Searching for MobileNetV3 - arXiv Vanity
This paper describes the approach we took to develop MobileNetV3 Large and Small models in order to deliver the next generation of high...
Read more >
tf.keras.applications.MobileNetV3Large | TensorFlow v2.11.0
In this use case, MobileNetV3 models expect their inputs to be float tensors of pixels with values in the [0-255] range. At the...
Read more >
Searching for MobileNetV3 - ResearchGate
MobileNetv3 is another highly efficient network constructed through neural architecture search (NAS) [14] . Since most networks do not consider ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found