Hi, I am loading trained checkpoints on person reid dataset like Market1501. I am using this repository for reid which is top on the leader board in reid. I am running inference on image folder when I run the inference command from here, it gives me the following error.
File "/home/facit/Faizan/reid/ctl/centroids-reid/modelling/backbones/resnet.py", line 157, in load_param
self.state_dict()[new_param_name].copy_(param_dict[i])
KeyError: 'center_loss.centers'
I think there is no key named center_loss.centers in state_dict, I am not sure how to solve this issue. How you please give some insight on it. Complete checkpoints loading code is given below for more information:
def load_param(self, model_path):
param_dict = torch.load(model_path)
if 'state_dict' in param_dict:
param_dict = param_dict['state_dict']
for i in param_dict:
if 'backbone' in i:
new_param_name = i[14:]
elif 'base' in i:
new_param_name = i[5:]
else:
new_param_name = i
if 'fc' in i:
continue
if 'bottleneck' in i:
continue
if 'classifier' in i:
continue
if 'transformer' in i:
continue
# print(type(self.state_dict()))
# print('\n')
# print(f'keys of state dict: {(self.state_dict().keys())}')
self.state_dict()[new_param_name].copy_(param_dict[i])
here is the resnet model file.