Training on new data with my own pretrained model - model fine tuning
See original GitHub issue❓ Questions and Help
I have trained a model on my own dataset (4 classes + background) starting from catalog://ImageNetPretrained/MSRA/R-50.
Now I want to use the output model from the training mentioned above model_final.pth
as the new starting point (instead of R-50) to train on new labeled data.
I set the MODEL.WEIGHT
in my config to the path of “model_final.pth” and it is able to load the model and it has the right number of layers and dimensions. However, when running training, specifically model.train() inside engine/trainer.py function do_train(…), it skips all training and immediately finishes. As shown here:
2019-01-23 00:13:49,014 maskrcnn_benchmark.trainer INFO: Start training
2019-01-23 00:13:49,082 maskrcnn_benchmark.trainer INFO: Total training time: 0:00:00.067745 (0.0001 s / it)
Am I missing a step? If I am fine tuning with the same number of classes, I don’t think I need to remove any layers (e.g. cls_score), even when I remove those the model does not train.
Thanks for the help in advanced!
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (8 by maintainers)
Top GitHub Comments
Hi @adrifloresm ,
In order to do that, all you need to do is to open a python interpreter, load the weights and save a new dict with only the
state_dict
in it.Something like
Let me know if it solves your problem.
A tutorial on how to finetune a model for a new dataset would be great!
I’d like to hold on a bit on adding yet more options in the config for now. I think that once we have the tutorial we would be able to see what are the biggest pain points, and have a better idea on how to address them.