Is there rgb2lab function for pytorch data (varaible or tensor or torch) read from an image?

same as the title…
is there rgb2lab function in pytorch?

1 Like

No, but there are some ways to convert your image.

  1. You could add the conversation to your Dataset and just convert the image after loading it:
from skimage import io, color
class MyData(Dataset):
    def __getitem__(self, index):
        rgb = io.imread(self.images[index])
        lab = color.rgb2lab(rgb)
        x = torch.from_numpy(lab)
  1. You could try to implement the conversion in PyTorch, if you really need to apply this function on a Tensor.
    Adobe has an older cookbook for the conversion.

I hope it helps!

thank you, good idea!