michuanhaohao / reid-strong-baseline

Bag of Tricks and A Strong Baseline for Deep Person Re-identification
http://openaccess.thecvf.com/content_CVPRW_2019/papers/TRMTMCT/Luo_Bag_of_Tricks_and_a_Strong_Baseline_for_Deep_Person_CVPRW_2019_paper.pdf
MIT License
2.24k stars 573 forks source link

run test.py get " Keyerror 'a' " #194

Closed 5Yesterday closed 3 years ago

5Yesterday commented 3 years ago
def load_param(self, trained_path):
    param_dict = torch.load(trained_path)
    for i in param_dict:
        if 'classifier' in i:
            continue
        self.state_dict()[i].copy_(param_dict[i])

run test.py get " Keyerror 'a' "

Change to this: def load_param(self, trained_path): param_dict = torch.load(trained_path) for k, v in param_dict.state_dict().items(): if 'classifier' in k: continue self.statedict()[k].copy(param_dict.state_dict()[k]) run test.py get " AttributeError: 'dict' object has no attribute 'state_dic' "