Maskrcnn-benchmark: How do I add a new model?

Created on 23 Nov 2018  ยท  7Comments  ยท  Source: facebookresearch/maskrcnn-benchmark

โ“ Questions and Help

I want to add a new model which is basically Res101 maskrccn without the FPN. Does setting USE_FPN=False here https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/configs/e2e_mask_rcnn_R_101_FPN_1x.yaml ensure no use of FPN?

Would I need to change any other files? If I were to make a new .yaml file with the name e2e_mask_rcnn_R_101_1x.yaml what changes would I need to do?

Currently, I have made a new .yaml file and set USE_FPN=False, and Anchor_Strides=(16,) as per default.

However, this gives me channel mismatch error
RuntimeError: Given transposed=1, weight of size [2048, 256, 2, 2], expected input[4, 256, 14, 14] to have 2048 channels, but got 256 channels instead
on line:
maskrcnn-benchmark/maskrcnn_benchmark/modeling/roi_heads/mask_head/roi_mask_predictors.py", line 35, in forward x = F.relu(self.conv5_mask(x))

question

All 7 comments

are you sure you have delete the files in output_dir?

There are a few more things you'd need to do, because there is currently no backbone for R-101 without FPN.
This should be fairly easy, here are the steps:

That should be pretty much it. The reason why there are a few more steps is that you are adding a new backbone.

Let me know if I missed something. But note that this will probably run much slower, and will probably not give better accuracies.

Thank you @fmassa for the detailed answer. A quick question, why do you think this will run slower?

Because FPN models are generally faster, because their HEAD is much smaller than the default HEAD from C4 models.

Do I need to change MODEL.ROI_BOX_HEAD.FEATURE_EXTRACTOR parameter if I want to test R-101-C4 backbone?
If so, do I need to register a new module? ( I only see ResNet50Conv5ROIFeatureExtractor in roi_box_feature_extractor.py).

@wesleylp the registration for R-101-C4 backbone has been just recently merged into master in https://github.com/facebookresearch/maskrcnn-benchmark/pull/346

I actually think you don't need to change ResNet50Conv5ROIFeatureExtractor, because the number of blocks in the last resnet block is the same for R-50 and R-101.

Hi @fmassa, thanks for your quick answer!
I've seen #346 handled the R-101-C4 backbone registration but I was unsure about ROI_BOX_HEAD.FEATURE_EXTRACTOR parameter.
Thank you, again!

Was this page helpful?
1 / 5 - 1 ratings