open-mmlab / mmsegmentation

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

rs_image_inference yields inferenced image that are not colored / in greyscale #3543

Open spcerrudo opened 5 months ago

spcerrudo commented 5 months ago

I have recently trained a model for remote sensing segmentation mapping. Unfortunately, the segment map displays the pixel classes in greyscale, not in the palette that I have set during the creation of custom dataset. The classes that are represented in the train model shows up in metrics / results so that is not the issue. Thank you very much for your time.

@DATASETS.register_module() class OpenEarthMapDataset(BaseSegDataset): """OpenEarthMap dataset.

In segmentation map annotation for OpenEarthMap, 0 is to ignore index.
``reduce_zero_label`` should be set to True. The ``img_suffix`` and
``seg_map_suffix`` are both fixed to '.png'.
"""

METAINFO = dict(
    classes=('bareland', 'rangeland', 'developed_space', 'road', 'tree',
             'water', 'agricultureland', 'building'),
    palette=[[128, 0, 0], [255, 255, 36], [148, 148, 148], [255, 255, 255],
             [34, 97, 198], [0, 69, 255], [75, 181, 73], [222, 31, 7]])

def __init__(self,
             img_suffix='.tif',
             seg_map_suffix='.tif',
             reduce_zero_label=False,
             **kwargs) -> None:
    super().__init__(
        img_suffix=img_suffix,
        seg_map_suffix=seg_map_suffix,
        reduce_zero_label=reduce_zero_label,
        **kwargs)

result image

spcerrudo commented 5 months ago

image

Zoulinx commented 3 months ago

Sorry, I forgot to consider the need for a color palette when designing the inference for large-scale remote sensing images. Additionally, known issues include displaying the progress of inference. These are expected to be addressed in the next version.