reid-strong-baseline icon indicating copy to clipboard operation
reid-strong-baseline copied to clipboard

test时出现问题

Open jsun-art opened this issue 4 years ago • 5 comments

测试时导入训练好的模型: model.load_param(cfg.TEST.WEIGHT) 出现问题: File "tools/test.py", line 61, in main model.load_param(cfg.TEST.WEIGHT) File "./modeling/baseline.py", line 179, in load_param for i in param_dict: TypeError: 'Baseline' object is not iterable

jsun-art avatar Feb 04 '21 04:02 jsun-art

I meet a similar problem that I cannot load my trained data, always show this problem. I choose different version about some pkg, but it is doesn't work.

Problem hits: File "tools/test.py", line 64, in main model.load_param(cfg.TEST.WEIGHT) File "./modeling/baseline.py", line 182, in load_param self.state_dict()[i].copy_(param_dict[i]) KeyError: 'model'

xingshuoli avatar Feb 07 '21 04:02 xingshuoli

Please refer to https://github.com/michuanhaohao/reid-strong-baseline/issues/101#issuecomment-556838939

michuanhaohao avatar Mar 05 '21 02:03 michuanhaohao

I meet a similar problem that I cannot load my trained data, always show this problem. I choose different version about some pkg, but it is doesn't work.

Problem hits: File "tools/test.py", line 64, in main model.load_param(cfg.TEST.WEIGHT) File "./modeling/baseline.py", line 182, in load_param self.state_dict()[i].copy_(param_dict[i]) KeyError: 'model'

hi! Have you ever done it?I have run this baseline and got the same problem.But it doesn't work after I tried the every solutions in #101 (comment) and other comments in issues.

Problem hits: Traceback (most recent call last): File "tools/test.py", line 67, in main() File "tools/test.py", line 61, in main model.load_param(cfg.TEST.WEIGHT) File "./modeling/baseline.py", line 179, in load_param self.state_dict()[i].copy_(param_dict[i]) KeyError: 'model'

24klaus avatar Mar 26 '21 03:03 24klaus

same problem, have you already solved?

PiseyYou avatar May 09 '22 10:05 PiseyYou

I meet a similar problem that I cannot load my trained data, always show this problem. I choose different version about some pkg, but it is doesn't work. Problem hits: File "tools/test.py", line 64, in main model.load_param(cfg.TEST.WEIGHT) File "./modeling/baseline.py", line 182, in load_param self.state_dict()[i].copy_(param_dict[i]) KeyError: 'model'

hi! Have you ever done it?I have run this baseline and got the same problem.But it doesn't work after I tried the every solutions in #101 (comment) and other comments in issues.

Problem hits: Traceback (most recent call last): File "tools/test.py", line 67, in main() File "tools/test.py", line 61, in main model.load_param(cfg.TEST.WEIGHT) File "./modeling/baseline.py", line 179, in load_param self.state_dict()[i].copy_(param_dict[i]) KeyError: 'model'

change as below can solve the issue

def load_param(self, trained_path):
    print("trained_path ", trained_path)
    param_dict = torch.load(trained_path)
    for i in param_dict['model']:
        if 'classifier' in i:
            continue
        if 'model' in i:
            continue
        self.state_dict()[i].copy_(param_dict['model'][i])

PiseyYou avatar May 10 '22 07:05 PiseyYou