Maskrcnn-benchmark: Training a model with data not COCO style

Created on 20 Feb 2019  ยท  6Comments  ยท  Source: facebookresearch/maskrcnn-benchmark

โ“ Questions and Help

Hi,

I'm trying to implement this model, but the context of the images is completely different to COCO's context, I mean there isn't similar classes or objects in general, so my question is if is possible to NOT use the COCO style format? I only have the information of every polygon in order to get the mask, also I need to use different classes, where are defined the classes of the model?

Thanks!

question

All 6 comments

You can create your own dataset object, like the one present in voc.py, but you'd need to also write some evaluation code and it would be quickly complicated.

You can use the COCO style dataset for your custom dataset, and the classes can be completely different. It's generally easier to go via this approach than writing your own evaluation script.

I'm closing this issue, but let me know if you have further questions

Hi @fmassa

You have right, I convert my dataset to COCO style, now I have a problem with the shapes, I already did the changes in the config file according with #297, I have only 5 classes (background included) but the model is still waiting for the 81 classes of coco dataset.

Error:
RuntimeError: Error(s) in loading state_dict for GeneralizedRCNN: size mismatch for roi_heads.box.predictor.cls_score.weight: copying a param with shape torch.Size([81, 1024]) from checkpoint, the shape in current model is torch.Size([5, 1024]). size mismatch for roi_heads.box.predictor.cls_score.bias: copying a param with shape torch.Size([81]) from checkpoint, the shape in current model is torch.Size([5]). size mismatch for roi_heads.box.predictor.bbox_pred.weight: copying a param with shape torch.Size([324, 1024]) from checkpoint, the shape in current model is torch.Size([20, 1024]). size mismatch for roi_heads.box.predictor.bbox_pred.bias: copying a param with shape torch.Size([324]) from checkpoint, the shape in current model is torch.Size([20]). size mismatch for roi_heads.mask.predictor.mask_fcn_logits.weight: copying a param with shape torch.Size([81, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([5, 256, 1, 1]). size mismatch for roi_heads.mask.predictor.mask_fcn_logits.bias: copying a param with shape torch.Size([81]) from checkpoint, the shape in current model is torch.Size([5]).

Idk if the problem is the model that I load, it's the same used in demo.ipynb: ../configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml

Or I have to change something else.

My class dataset has the same structure of coco.py, extends torchvision.datasets.coco.CocoDetection and has the same returning values (without keypoints).

I'm literally reading all the source code in order to understand as much as possible (btw it's a beautiful code), I want to make a tutorial step-by-step of how to use this model, but it's a bit tricky.

Thanks.

The problem is that you need to adapt the state_dict of the model to remove the last layers, which are specific to COCO (81 classes). More information can be found in https://github.com/facebookresearch/maskrcnn-benchmark#finetuning-from-detectron-weights-on-custom-datasets

Excellent! Thanks for your quick response!!

Hi
I have created a Maskrcnn_benchmark model for medical images with 3 classes (High grade, Normal grade and Low grade). My model detects only high grade, not other two which means I got only one specific output. I have used coco style json file, 5000 Iterations, 93 high grade images, 23 normal images and 25 low gade images. Any help please.
Many thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IenLong picture IenLong  ยท  4Comments

BelhalK picture BelhalK  ยท  4Comments

Idolized22 picture Idolized22  ยท  3Comments

hadim picture hadim  ยท  4Comments

adityaarun1 picture adityaarun1  ยท  3Comments