Hello all, I am using resnet-50 pretrain model from pytorch vision. Before using the pretrained model, my input data is as below for training from scratch
input = torch.from_numpy(image.transpose((2,0,1))).float().div(255)

For using pretrain model, I have to follow the normalization method as pytorch did, especially, my code is
    input = torch.from_numpy(image).double()
    mean = np.array([0.485, 0.456, 0.406])
    mean = torch.from_numpy(mean)
    std = np.array([0.229, 0.224, 0.225])
    std = torch.from_numpy(std)
    input = std * input + mean
    input = np.clip(input, 0, 1)

Is the above normalization way correct for input of resnet 50 pretrained model? I found that it take a lot of time in comparsion with my first way (div by 255)