I am working on Audi A2D2 dataset 2D segmentation.
The segmentation mask are provided as 3-channel, RGB images (despite having only 55 classes).
In order to process the labels faster in my data loader, I’d like to open them as grayscale even though they are RGB. Because there are only 55 different RGB pixel values, it should be possible to convert to gray scale and keeping unique pixel value for the 55 classes, since there are 256 possible shades of grey.
from torchvision.io import read_image
from torchvision.io.image import ImageReadMode

read_image(path, mode=ImageReadMode.RGB)

I’m wondering: is there a risk of 2 RGB pixel being assigned the same grayscale value, when opening an RGB picture with ImageReadMode.GRAY?