Retrieve segmentation labels from segmentation mask

Hi, i’m trying to do semantic segmentation using Segformer(I would appreciate an advice if there is a better transformer based segmentation model).

i have a dataset with images with the mask(label) images but i don’t have a csv of dataset where labels are with their mask representations (tuple of rgb color value, for example ((255,235,0): car) and etc…)

Question is, how can i retrieve segmentation mask colors for each class in the dataset? is there any way to do that ?