How do they know mean and std, the input value of transforms.Normalize

后端 未结 1 1768
心在旅途
心在旅途 2021-01-05 18:46

The question is about the data loading tutorial from the PyTorch website. I don\'t know how they write the value of mean_pix and std_pix of the in

相关标签:
1条回答
  • 2021-01-05 19:16

    For normalization input[channel] = (input[channel] - mean[channel]) / std[channel], the mean and standard deviation values are to be taken from the training dataset.

    Here, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225] are the mean and std of Imagenet dataset.

    On Imagenet, we’ve done a pass on the dataset and calculated per-channel mean/std. check here

    The pre-trained models available in torchvision for transfer learning were pretrained on Imagenet, so using its mean and std deviation would be fine for fine-tuning your model.

    If you're trying to train your model from scratch, it would be better to use the mean and std deviation of your training dataset (face dataset in this case). Other than that, in most of the cases, the mean and std of Imagenet suffice for your problem.

    0 讨论(0)
提交回复
热议问题