JDAI-CV / fast-reid

SOTA Re-identification Methods and Toolbox
Apache License 2.0
3.39k stars 830 forks source link

Skip loading parameter 'heads.weight' to the model due to incompatible shapes: (751, 2048) in the checkpoint but (0, 2048) in the model! You might want to double check if this is expected. #689

Closed nazmulnnb closed 1 year ago

nazmulnnb commented 1 year ago

I have retrained the model with Market1501 using bagtricks_R101-ibn.yml configuration file. Accuracy is as expected, but I am getting the following warning while loading the model for inference.

Skip loading parameter 'heads.weight' to the model due to incompatible shapes: (751, 2048) in the checkpoint but (0, 2048) in the model! You might want to double check if this is expected.
chansongoal commented 1 year ago

Hi nazmulnnb, I also encountered the same problem, have you figured it out? Thanks in advance for replying.

nazmulnnb commented 1 year ago

@chansongoal I was not able to fix it. After checking the codes, it seems like the model built for inference differs from the model built for training. The head of the inference model doesn't contain the softmax layer. As we are using only in embedding output, I think it's okay not to worry about the softmax layer. I just left it like it was. If the warning bothers you, you can just simply delete it from the weight.

I might be wrong. I am also expecting a clarification from the original author.

chansongoal commented 1 year ago

@chansongoal I was not able to fix it. After checking the codes, it seems like the model built for inference differs from the model built for training. The head of the inference model doesn't contain the softmax layer. As we are using only in embedding output, I think it's okay not to worry about the softmax layer. I just left it like it was. If the warning bothers you, you can just simply delete it from the weight.

I might be wrong. I am also expecting a clarification from the original author.

I agree with you that the softmax layer is not necessary for inference. But I got another problem: many parameters like "heads.bottleneck.0.weight", "heads.bottleneck.0.bias", etc., cannot be found in the pertrained model. And some parameters like "heads.bnneck.weight" which contained in the pertrained model are not used. I guess "heads.bnneck.weight" contained in the pretrained model is the "heads.bottleneck.0.weight" needed in the model. And I rename the parameters in the pretrained model, but the evaluation results is lower than those reported in the MODEL_ZOO. Did you encounter the same problem?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.