Skip to content

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

Open
@Ddlozada21

Description

@Ddlozada21

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!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions