I’ve seen many tutorials where first a transform object is created and then it is passed as an argument to ImageFolder() to create dataset. Transform object can normalize data by picking mean and the standart deviation for every channel. An example:
transform = transforms.Compose(
    [transforms.ToTensor(),
     transforms.Normalize((some_values between [0, 1]), (some_values between [0, 1]))])

train_dataset = ImageFolder(train_dir, transform)

What I don’t understand is how can we know what are mean and std values before we pass it to for example ImageFolder() class. What it looks to me is that we have to KNOW what are means and stds before we even have a chance to process dataset. Do we need to first preprocess all data, and calculate mean and std manually?  Many tutorials show how to calculate mean and std after we create loaders, but isn’t it worthless to know these numbers if we already have all loaders created? Am I missing some key idea behind the logic of this or is there a way (a smart way where you wouldn’t need to separately preprocess every image) to find what mean and std for every channel are?