Open mrteera opened 5 years ago
_load_c2_pickled_weights()
is used to load only Caffe2 checkpoints in .pkl
format
https://github.com/facebookresearch/maskrcnn-benchmark/blob/24c8c90efdb7cc51381af5ce0205b23567c3cd21/maskrcnn_benchmark/utils/checkpoint.py#L132-L134
To load pre-trained weights into the model with different ROI_BOX_HEAD.NUM_CLASSES
refer to
https://github.com/facebookresearch/maskrcnn-benchmark#finetuning-from-detectron-weights-on-custom-datasets
To use trim_detectron_model.py
suggested in README.md with .pth
file check out #15 , more precisely https://github.com/facebookresearch/maskrcnn-benchmark/issues/15#issuecomment-498575917
@Dorozhko-Anton Thank you. I successfully convert .pth model file using trim_detectron_model
. These are my changed. I'll update again when I train a model with this pre-train weights.
_d = torch.load(DETECTRON_PATH)
newdict['model'] = removekey(_d['model'],
['module.roi_heads.box.predictor.cls_score.bias', 'module.roi_heads.box.predictor.cls_score.weight', 'module.roi_heads.box.predictor.bbox_pred.bias', 'module.roi_heads.box.predictor.bbox_pred.weight'])
❓ Questions and Help
I'm trying to use FBNet as a pre-trained weights for my dataset (
ROI_BOX_HEAD: NUM_CLASSES: 3
). But it cannot load the weights using this utils_load_c2_pickled_weights()
https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/maskrcnn_benchmark/utils/c2_model_loading.py#L192Do you have any suggestion to load pre-trained FBNet weights for a custom dataset?
Related coment: https://github.com/facebookresearch/maskrcnn-benchmark/pull/507#issuecomment-470749620