📜  图像加载器 RGB 变换 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:40.185000             🧑  作者: Mango

代码示例1
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)