open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.1k stars 9.38k forks source link

How can I only use mask and images to train Instance segmentation, such as Mask2former? #8599

Open ShanZard opened 2 years ago

ShanZard commented 2 years ago

In a cell segmentation competition, I only get mask and image.But this is a typical instance segmentation task.I can train in mmsegmentation , but I want to use Mask2former. I would appreciate it ,if you could give me an example. About my dataset is very common in semantic segmentation.Background 0 ,Interior 1 ,Boundary 2.I can easy train in mmsegentation

BIGWangYuDong commented 2 years ago

have you tried to load your gt by using https://github.com/open-mmlab/mmdetection/blob/3b72b12fe9b14de906d1363982b9fba05e7d47c1/mmdet/datasets/pipelines/loading.py#L473-L481

You can follow the logic of LoadPanopticAnnotations and use load your own dataset. Maybe you should change some code, but I think it will work

ShanZard commented 2 years ago

Thanks for you advice.I will follow the logic of LoadPanopticAnnotations load my dataset . And I want to confirm that if I haven't anchor box I alse can train instance segmentation in mmdet.

BIGWangYuDong commented 2 years ago

I think it may work, but you should make sure the model do not need gt_bboxes during training.

ShanZard commented 2 years ago

Thanks for your reply .Mask2former needn't bboxes during training.

class LoadPanopticAnnotations(LoadAnnotations):
    """Load multiple types of panoptic annotations.

    Args:
        with_bbox (bool): Whether to parse and load the bbox annotation.
             Default: True.
        with_label (bool): Whether to parse and load the label annotation.
            Default: True.
        with_mask (bool): Whether to parse and load the mask annotation.
             Default: True.
        with_seg (bool): Whether to parse and load the semantic segmentation
            annotation. Default: True.
        file_client_args (dict): Arguments to instantiate a FileClient.
            See :class:`mmcv.fileio.FileClient` for details.
            Defaults to ``dict(backend='disk')``.
    """

I only have every image and mask(About my dataset is very common in semantic segmentation.Background 0 ,Interior 1 ,Boundary 2.) So how to set this bool?I can't find about the interpretation oft _label _mask _seg

aiakash commented 1 year ago

im also looking for same,i want to train instance seg model apart from maskrncc