lhoyer / DAFormer

[CVPR22] Official Implementation of DAFormer: Improving Network Architectures and Training Strategies for Domain-Adaptive Semantic Segmentation
Other
470 stars 93 forks source link

How to use own dataset? #3

Closed DJayalath closed 2 years ago

DJayalath commented 2 years ago

I have my own dataset with:

  1. Images from domain A
  2. Segmentations from domain A
  3. Images from domain B

How can I apply your code to train the model on this to predict segmentations for the images in domain B?

lhoyer commented 2 years ago

In order to use your own datasets for A and B, you could create a subclass for each inheriting from CustomDataset. Please, have a look at mmseg/datasets/cityscapes.py and mmseg/datasets/gta.py as a reference. Further documentation is also provided by the mmsegmentation framework: https://mmsegmentation.readthedocs.io/en/latest/tutorials/customize_datasets.html. Additionally, you need to add the new data loaders to mmseg/datasets/__init__.py.

In order to use the newly created data loaders, you can adjust the dataset configs such as configs/base/datasets/uda_gta_to_cityscapes_512x512.py by replacing CityscapesDataset and GTADataset with the names of your new data loaders and providing your dataset paths.

DJayalath commented 2 years ago

Thank you for your helpful advice! I followed your instructions and managed to create a custom dataset. I also had to create a new config in configs/daformer based on configs/daformer/gta2cs_uda_warm_fdthings_rcs_croppl_a999_daformer_mitb5_s0.py

EudicL commented 1 year ago

Thank you for your helpful advice! I followed your instructions and managed to create a custom dataset. I also had to create a new config in configs/daformer based on configs/daformer/gta2cs_uda_warm_fdthings_rcs_croppl_a999_daformer_mitb5_s0.py

Hello, could you please share the code you modified?