microsoft / seismic-deeplearning

Deep Learning for Seismic Imaging and Interpretation
MIT License
403 stars 142 forks source link

The colormap used in mask_to_disk does not support more than 12 classes, will leads to incorrect results for datasets with more than 12 classes #324

Closed yalaudah closed 4 years ago

yalaudah commented 4 years ago

In the file cv_lib/cv_lib/utils.py, the Paired colormap used in mask_to_disk does not support more than 12 classes.

def mask_to_disk(mask, fname, cmap_name="Paired"):
    """
    write segmentation mask to disk using a particular colormap
    """
    cmap = plt.get_cmap(cmap_name)
    Image.fromarray(cmap(normalize(mask), bytes=True)).save(fname)

This must be fixed to support an arbitrary number of classes.