NVlabs / DG-Net

:couple: Joint Discriminative and Generative Learning for Person Re-identification. CVPR'19 (Oral) :couple:
https://www.zdzheng.xyz/publication/Joint-di2019
Other
1.27k stars 230 forks source link

issue with 'net_last.pth' #58

Closed khodabakhshih closed 3 years ago

khodabakhshih commented 3 years ago

Hi Thanks for your great work. I use the pre-trained model for feature extraction using function “extract_feature” in the file “test2_label.py”. There is no problem with ‘.pt’ models in the “outputs” folder, but when I want to use the ‘net_last.pth’ model in folder “model” I receive the following error: KeyError Traceback (most recent call last)

in () KeyError: 'a' Would you please guide me to debug this error? Is it about the “config.yaml” file exists in folder “outputs” and does not exist in folder “model”? Thank you very much and looking forward to hearing you Regards Hossein
khodabakhshih commented 3 years ago

I think it is about line 91 in file "test2_label.py" network.load_state_dict(state_dict['a'], strict=False) the '.pt' files has 'a' and '.pth' has not. Therefore for '.pth' files we should use: network.load_state_dict(state_dict, strict=False)

khodabakhshih commented 3 years ago

another question: what '.yaml' file should be use for '.pth' files? why the cosine distance of feature vectors using '.pth' files are near 1 while it is nice for '.pt' files?

layumi commented 3 years ago

Hi @khodabakhshih I wrote many different structure choices for our model structure.

So we need to load yaml config files to get the right model structure first.

Then we can load the weight into the model structure.

layumi commented 3 years ago
-- models # contain the teacher models
-- outputs # contain the final DG-Net models
khodabakhshih commented 3 years ago

@layumi Thank you very much.