Closed gnscc closed 1 year ago
Hi, you might find this issue and my example for training Mask2Former on a custom dataset useful: https://github.com/open-mmlab/mmsegmentation/issues/2914#issuecomment-1588921613
Thank you @edsml-hmc122 for the example.
Hi, you might find this issue and my example for training Mask2Former on a custom dataset useful: #2914 (comment)
Finally, the clues for me to get it work were:
cfg.model.decode_head.loss_cls.class_weight = [1.0] * cfg.num_classes + [0.1]
Check mask png files. Be sure only the mask colors are saved. For example, if only 2 classes exists, the depth should be 2 or the color number is 2.
Intro
Hi, I am getting stuck when trying to adapt mask2former_swin-s_8xb2-160k_ade20k-512x512 config for my own dataset. I am new using mmsegmentation and I am trying to learn the clues for custom datasets.
Works in ADE
First of all, I have successfully set up the training for ADE with the following script. Basically I just have loaded the provived config and changed data_root param where it actually the data remains in my system.
train_mask2former_ade.py
My dataset
My custom dataset contains grayscale images and grayscale annotations. I suspect that input data has to be in rgb, which is not a problem because I have already converted the same dataset to 3 channel if needed.
The dataset contains three classes: background, product and "espinas". Annotated with 0, 100 and 200 grayscale values respectively. I am not sure if label values have to be consecutive, if needed I would transform the values to 0, 1 and 2 with no further problem.
I have registered my dataset with the given code, and importing it and adding it to init .py mmsegmentation/mmseg/datasets/espinas.py
mmsegmentation/mmseg/datasets/init.py
Config for training custom dataset
Where I get stuck is in changing the mask2former_swin-s_8xb2-160k_ade20k-512x512.py config to train in the dataset described above. What I have changed:
Here is the final config file mask2former_swin-s_8xb2-160k_espinas-512x512.py:
Training
To train in my custom dataset I run this script train_mask2former_espinas.py
And I get this error:
Please, can someone provide me some hint on which may be the problem? Thanks in advance