Answers for "Image loader RGB transform"

0

Image loader RGB transform

While loading your images, you could use Image.open(path).convert('RGB') on all images.
If you are using ImageFolder, this functionality should be already there using the default loader.

def myloader(filename):
    return Image.open(filename).convert('RGB')


dog_test = datasets.ImageFolder('/data/dog_images/test',transform = valid_transform,loader=myloader)
test = torch.utils.data.DataLoader(dataset=dog_test,batch_size=64)
Posted by: Guest on June-13-2020

Python Answers by Framework

Browse Popular Code Answers by Language