You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use the pretrained weights provided in the readme, but am having some trouble. I loaded model_final.pth as a state_dict, and then tried to load it into a new instance of KeypointDetector, but this hit an error because the expected keys for a KeypointDetector state_dict and the given dictionary keys do not match up. What am I doing wrong?
Thanks,
Josh
The text was updated successfully, but these errors were encountered:
It seems like the codebase may have changed since the pretrained weights were saved. I found the following (manually changed) key names gets things to work:
pretrained = torch.load('/mnt/drive/MyDrive/Datasets/SMOKE/model_final.pth')['model']
for k1, k2 in zip(sorted(pretrained.keys()), sorted(model.state_dict().keys())):
assert(k1.replace('module.', '') == k2)
model.state_dict()[k2][:] = pretrained[k1]
EDIT: reading the code further, there's just some extra information that's saved when the training script serializes the model (training debug data, etc.). It looks like
Hi,
I'm trying to use the pretrained weights provided in the readme, but am having some trouble. I loaded model_final.pth as a state_dict, and then tried to load it into a new instance of KeypointDetector, but this hit an error because the expected keys for a KeypointDetector state_dict and the given dictionary keys do not match up. What am I doing wrong?
Thanks,
Josh
The text was updated successfully, but these errors were encountered: