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

执行detect出错。 #22

Open
MasonZong opened this issue Dec 24, 2021 · 3 comments
Open

执行detect出错。 #22

MasonZong opened this issue Dec 24, 2021 · 3 comments

Comments

@MasonZong
Copy link

MasonZong commented Dec 24, 2021

当我执行detect.py时,出现如下错误。使用的是voc训练权重.。
`
Traceback (most recent call last):
File "detect.py", line 86, in
model.load_state_dict(torch.load("./checkpoint/model_1.pth",map_location=torch.device('cpu')), strict=True)
File "/home/zhangpan/anaconda3/envs/torch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1052, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for DataParallel:
size mismatch for module.fcos_body.head.cls_logits.weight: copying a param with shape torch.Size([80, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([20, 256, 3, 3]).
size mismatch for module.fcos_body.head.cls_logits.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([20]).

`

@MasonZong MasonZong changed the title 当我执行detect.py时,出现如下错误。使用的是voc训练权重,我自己训练之后使用自己的模型也是出现这个错误。 执行detect出错。 Dec 24, 2021
@zhenghao977
Copy link
Owner

@MasonZong config.py 默认是coco的80类,如有需要在voc上测试,更改这个配置文件中的类别数目即可。

@liukangji
Copy link

当我执行detect.py时,出现如下错误。使用voc训练 权 重 。 /checkpoint/model_1.pth",map_location=torch.device('cpu')), strict=True) 文件"/home/zhangpan/anaconda3/envs/torch/lib/python3.7/site-packages/torch/nn /modules/module.py”,第 1052 行,在 load_state_dict 中 。name , "\n\t".join(error_msgs))) RuntimeError: 为 DataParallel 加载 state_dict 时出错: module.fcos_body.head.cls_logits.weight 的大小不匹配:复制形状为 torch.Size([ 80, 256, 3, 3]) 从检查点开始,当前模型中的形状是 torch.Size([20, 256, 3, 3])。 module.fcos_body.head.cls_logits.bias 的大小不匹配:从检查点复制形状为 torch.Size([80]) 的参数,当前模型中的形状为 torch.Size([20])。

`你好,使用文件detect的时候,你会出现了很多乱框了吗?

@blackbabyzz
Copy link

是model下的config吗 我改了class_num 依然不对啊怎么回事

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

4 participants