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 transforms.Normalize without calculation
I'm unable to find any explanation relevant to this question on StackOverflow.
import torch
from torchvision import transforms, datasets
data_transform = transforms.Compose([
transforms.RandomSizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
hymenoptera_dataset = datasets.ImageFolder(root='hymenoptera_data/train',
transform=data_transform)
dataset_loader = torch.utils.data.DataLoader(hymenoptera_dataset,
batch_size=4, shuffle=True,
num_workers=4)
The value mean=[0.485,0.456, 0.406]
and std=[0.229, 0.224, 0.225]
is not obvious to me. How do they get them? And why are they equal to these?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…