SHI-Labs / OneFormer

OneFormer: One Transformer to Rule Universal Image Segmentation, arxiv 2022 / CVPR 2023
https://praeclarumjj3.github.io/oneformer
MIT License
1.41k stars 128 forks source link

Training on custom dataset #32

Closed sushilkhadkaanon closed 1 year ago

sushilkhadkaanon commented 1 year ago

Could you please provide detailed instructions on training for a custom dataset? Read the Custom training page but couldn't understand anything.

praeclarumjj3 commented 1 year ago

Hi @sushilkhadkaanon, thanks for your interest in our work.

I believe the instructions are comprehensive enough, as other users (#17, #31) have been able to train on custom datasets following my instructions. I suggest you spend some more time trying to understand registering custom datasets in Detectron2 and then try preparing a custom dataset mapper.

Let me know if you have any specific issues.

sushilkhadkaanon commented 1 year ago

Hi! Thanks, I really appreciate your work. I tried following your instructions. I added InstanceCOCOCustomNewBaselineDatasetMapper in build_train_loader of train_net.py But where do I register my dataset? ` #

from detectron2.data.datasets import register_coco_instances

register_coco_instances("my_dataset_train", {}, "_annotations.coco.json", "custom_data/train")
register_coco_instances("my_dataset_test", {}, "_annotations.coco.json", "custom_data/train")

metadata_train = MetadataCatalog.get("my_dataset_train")
cfg.DATASETS.TRAIN = ("my_dataset_train",)
cfg.DATASETS.TEST = ("my_dataset_test",)

cfg.SOLVER.MAX_ITER = 5 

` 

Added this inside main function in train_net.py.
Now this is giving me `ModuleNotFoundError: 

  Please compile MultiScaleDeformableAttention CUDA op with the following commands:
\`cd mask2former/modeling/pixel_decoder/ops\`
\`sh make.sh\``
praeclarumjj3 commented 1 year ago

You can look at register_ade20k_instance.py for reference. You need to create a similar file for your dataset. Also, the official detectron2 guide on adding custom datasets is quite detailed.