Handling images with transparencies


(Spandan Madan) #1

Hi, I have some images in my dataset that are PNG’s with transparencies. When I try to read images using built in dataloader, It generates the warning -

"UserWarning: Palette images with Transparency expressed in bytes should be converted to RGBA images"

How do I handle this? Any ideas?

Thanks!


#2

looks like the default loader converts to ‘RGB’:

By default with ImageLoader you can specify your own loader: https://github.com/pytorch/vision/blob/master/torchvision/datasets/folder.py#L92