w1oves / Rein

[CVPR 2024] Official implement of <Stronger, Fewer, & Superior: Harnessing Vision Foundation Models for Domain Generalized Semantic Segmentation>
https://zxwei.site/rein
GNU General Public License v3.0
215 stars 19 forks source link

How to train on new dataset. #21

Closed SuiyvSYC closed 5 months ago

SuiyvSYC commented 5 months ago

@w1oves Thanks for sharing your code, I was wondering which part of the code I should modify if I want to train my own data set? Because your code is complicated, I am not sure if it is ok to modify only train_dataloader? And I don't know how to modify train_dataloader properly Now, can you choose one of the following questions to answer me? First question: How do you train the model without using mmengine Second question: If you have to use mmengine, how many parameter Settings in your config file are redundant? In other words, how many of the parameters in configs/dinov2/rein_dinov2_mask2former_512x512_bs1x4.py can be removed during training?

If you could answer my question, I would be very grateful for it.

w1oves commented 5 months ago

If you intend to train a model on a new dataset, follow these steps:

  1. Create a new configuration file Cfg1 by copying and pasting the configuration from configs/dinov2/rein_dinov2_mask2former_512x512_bs1x4.py.
  2. Create a new dataset configuration Cfg2 in configs/_base_/datasets/.
    • For standard settings, link it to configs/_base_/datasets/cityscapes_512x512.py.
    • For domain generalization settings, link it to configs/_base_/datasets/dg_gta_512x512.py.
  3. Adjust certain parameters in Cfg2, such as train_pipeline (especially for scale), data_root, data_prefix, data_suffix, img_suffix, and seg_map_suffix. Also, modify num_classes in Cfg1.
  4. Replace the imported dataset in the _base_ section of Cfg1.

For more detailed information, refer to the documentation.