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

关于test模型不匹配问题 #26

Open
yan320 opened this issue Jan 11, 2025 · 1 comment
Open

关于test模型不匹配问题 #26

yan320 opened this issue Jan 11, 2025 · 1 comment

Comments

@yan320
Copy link

yan320 commented Jan 11, 2025

您好,感谢您开源您的工作,我对该工作非常感兴趣!
但是我在训练完成后,在测试时出现加载模型不匹配的问题,请问这是什么原因?
Traceback (most recent call last):
File "test.py", line 114, in
test()
File "test.py", line 52, in test
net.load_state_dict(torch.load(opt.pth_dir, map_location=device)['state_dict'])
File "C:\Users\Yang.conda\envs\seg\lib\site-packages\torch\nn\modules\module.py", line 1667, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Net:
Unexpected key(s) in state_dict: "model.stem.0.weight", "model.stem.0.bias", "model.stem.0.running_mean", "model.stem.0.running_var", "model.stem.0.num_batches_tracked", "model.stem.1.weight", "model.stem.2.weight", "model.stem.2.bias", "model.stem.2.running_mean",
"model.stem.2.running_var", "model.stem.2.num_batches_tracked", "model.stem.4.weight", "model.stem.5.weight"

@XinyiYing
Copy link
Owner

存下来的模型参数和使用的模型不匹配,可以再仔细检查一下

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