open-mmlab / mmsegmentation

OpenMMLab Semantic Segmentation Toolbox and Benchmark.
https://mmsegmentation.readthedocs.io/en/main/
Apache License 2.0
7.99k stars 2.57k forks source link

How to make ONE class correspond to multiple pixel values in the dataset? #2099

Open plainzzj opened 1 year ago

plainzzj commented 1 year ago

In my work, the picture only contains apples and backgrounds, but each apple corresponds to a pixel value (instance segmentation). How to make multiple pixel values (such as 1-254) correspond to a category: "Apple".

Thank you very much.

MengzhangLI commented 1 year ago
label_map (dict): Mapping old labels to new labels. Default: dict().

Try to use label_map. You can global search this keyword and try to set it in proper position.

plainzzj commented 1 year ago

Thank you very much for your support! I try to add label_map = dict(zip([x for x in range(2,150)], [1]*150)) Change all instance tags to 1. I want to know that in the config file, the num_classes from decode_head and auxiliary_head ,whether to use the maximum number of instances (150), or can it be changed to 2 (background+apple).

Thank you again for your support in your busy schedule!

plainzzj commented 1 year ago

Add a question: should I set the parameter custom_classes to True?