Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教加载Resnet50-ir报错“invalid load key, '\xff'.”问题 #36

Closed
GitHubLuGeng opened this issue Feb 4, 2021 · 3 comments
Closed

Comments

@GitHubLuGeng
Copy link

GitHubLuGeng commented Feb 4, 2021

使用3.1 Experiments of SOTA backbones下的模型时,发现有些模型可以加载成功有些会报错
我的pytorch为1.1.0 GPU版本

按照如下方式加载MobileFaceNet模型成功
model = MobileFaceNet(512, 7, 7)
model = nn.DataParallel(model)
model.load_state_dict(torch.load(‘model.pt', False)

但是按照同样方式加载Resnet50-ir模型报错“invalid load key, '\xff'.”
model = Resnet(152, 0.4)
model = nn.DataParallel(model)
model.load_state_dict(torch.load(‘model.pt’, False)

请问一下要怎么样才能正确加载Resnet50-ir模型?

@wang21jun
Copy link
Collaborator

Please refer to backbone/backbone_def.py
model = Resnet(50, 0.4, 'ir', 512, 7, 7)

@GitHubLuGeng
Copy link
Author

GitHubLuGeng commented Feb 5, 2021

Please refer to backbone/backbone_def.py
model = Resnet(50, 0.4, 'ir', 512, 7, 7)

1.已经修改成model = Resnet(50, 0.4, 'ir', 512, 7, 7),还是报同样的错误
2.我又尝试了一下下面你们提供的加载方式,依然报错“invalid load key, '\xff'.”
backbone_conf_path = "/home/lu/PycharmProjects/FaceX-Zoo/test_protocol/backbone_conf.yaml"
backbone_factory = BackboneFactory("ResNet", backbone_conf_path)
model_loader = ModelLoader(backbone_factory)
model = model_loader.load_model(self.cfg['model_file_path'])
详细报错信息如下
Start to load the face recognition model...
backbone param:
{'depth': 50, 'drop_ratio': 0.4, 'net_mode': 'ir', 'feat_dim': 512, 'out_h': 7, 'out_w': 7}
Failed to load face recognition model.
invalid load key, '\xff'.

Process finished with exit code 255
3.我的环境是ubuntu16+python3.6+pytorch1.1.0

@GitHubLuGeng
Copy link
Author

@wang21jun
好像是Resnet50-ir模型文件有问题,我又下载了一个Resnet152-irse的模型文件,使用同样的方式能加载成功
详细日志如下
Start to load the face recognition model...
backbone param:
{'depth': 152, 'drop_ratio': 0.4, 'net_mode': 'ir_se', 'feat_dim': 512, 'out_h': 7, 'out_w': 7}
Success!
face model loaded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants