chenhang98 / BPR

code for `Look Closer to Segment Better: Boundary Patch Refinement for Instance Segmentation`
Apache License 2.0
173 stars 23 forks source link

Generating instance segmentation .json file #33

Closed eregen closed 1 year ago

eregen commented 1 year ago

I don't understand how to use mask rcnn on the COCO dataset to generate the coarse segmentation results. I don't see it described this way on the Mask R-CNN repo. What specific step do I take to create the 'mask_rcnn_r50.train.segm.json' dataset? Any clarification would be greatly appreciated!

chenhang98 commented 1 year ago

HI, we generated those json files using mmdetection. You can refer to the 6th example in https://mmdetection.readthedocs.io/en/stable/1_exist_data_model.html#examples.

eregen commented 1 year ago

I still have 2 questions. First, how do you get the mask_rcnn_r50.train.segm.json if mmdet only let's you use mask r-cnn on the validation set? What do you modify in the example to infer on the training set? I thought you couldn't infer on data the network was trained on.

Second, how do we use BPR with images that have no annotations like COCO test set? The inference script you have requires annotation, so what do we change just to get predictions?

chenhang98 commented 1 year ago

Hi, for question 1, you can do this by slightly modifying the configure file of mmdet, for example:

data = dict(
    imgs_per_gpu=1,
    workers_per_gpu=2,
    test=dict(
        type=dataset_type,
        ann_file=data_root +
        # 'annotations/instancesonly_filtered_gtFine_test.json',      # inference on test set
        # img_prefix=data_root + 'leftImg8bit/test/',
        # 'annotations/instancesonly_filtered_gtFine_val.json',       # inference on val set
        # img_prefix=data_root + 'leftImg8bit/val/',
        'annotations/instancesonly_filtered_gtFine_train.json',       # inference on train set
        img_prefix=data_root + 'leftImg8bit/train/',
        pipeline=test_pipeline))

For question 2, you can generate a dummy annotation file that does not contain the 'annotations' field. Our script needs this file for information such as image file list and sizes. You can refer to 'instancesonly_filtered_gtFine_test.json' in https://github.com/open-mmlab/mmdetection/blob/master/tools/dataset_converters/cityscapes.py as an example.

yuzeWAN commented 6 months ago

Dear author, hello: The link you provided cannot be opened. Could you please provide a reference link that can be opened?