代码怕忘记,现在贴上来,以防丢失
from torch.utils.data import DataLoader
from torchvision.datasets import ImageFolder
import torch
from torchvision import transforms
def get_mean_and_std(data_path, in_chans=3):
dataset = ImageFolder(root=data_path, transform=transforms.ToTensor()