What's the channel order of images for resnet model in model_zoo?


(Yufeng Ma) #1

BGR or RGB? And also what is the scale of input images? I’ve seen tutorials with both [0,255] and [0,1] scales.


(Tong Xiao) #2

In RGB order with pixels in [0, 1]. Please check this line for loading an image.


(JongHwa Jung) #3

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)