Skip to content

How to properly migrate a trained model from MMDetection v2 to MMDetection v3? #12340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Ddlozada21 opened this issue Mar 31, 2025 · 0 comments
Assignees

Comments

@Ddlozada21
Copy link

Hi! I'm trying to migrate a trained model from MMDetection 2.x to MMDetection 3.x and I'm facing some issues.

I have:

A config file originally written for MMDetection v2 (with model, data, pipeline, etc.)

A .pth checkpoint file trained using that config

My goal is to continue training (fine-tuning) the model in MMDetection v3 using this .pth

I’ve already tried adapting the config to the v3 format following the migration guide, but when I load the model using the Runner with load_from, I get errors such as:

TypeError: conv2d() received an invalid combination of arguments - got (list, Parameter, NoneType, ...)
Also, I receive warnings like:

unexpected key in source state_dict: fc.weight, fc.bias

It seems like the architecture has changed enough that loading the weights directly is no longer fully compatible.

What is the recommended way to migrate a model trained with MMDetection 2.x (checkpoint + config) to MMDetection 3.x so I can continue training or inference?

Should I:

  • Only extract backbone weights from the .pth and re-use them with init_cfg?

  • Manually adapt the state_dict?

  • Is there a conversion script available?

Thanks in advance for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants