Preparing Your Dataset For Training
When training a multi-class segmentation model, loss functions such as the CrossEntropyLoss() in Pytorch require the mask to be categorically labeled.
As in the image above, the RGB mask (middle) is properly segmented but all the pixels are still ranged from 0 to 255 and is not assigned to a specific class index number. So, if the only dataset you have is the RGB mask, you need to convert the data to a Categorical Label Mask(left) when training a model.
The Categorical Label Mask(left) is dark due to having low values.