BGR or RGB? And also what is the scale of input images? I’ve seen tutorials with both [0,255] and [0,1] scales.
a Normailize transform make a image from [0, 255] to [0, 1]
If your image is [0,1], you should ignore normalization
here is a tutorial
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
batch_size = 256
train_loader = torch.utils.data.DataLoader(
datasets.ImageFolder(traindir,
transforms.Compose([
transforms.RandomSizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
normalize,])),
batch_size=batch_size,
shuffle=True,
num_workers=4)
1 Like