Link: torchvision.models — Torchvision master documentation 36
From link:
"
All pre-trained models expect input images normalized in the same way, i.e. mini-batches of 3-channel
RGB images of shape (3 x H x W), where H and W are expected to be at least 224. The images have to be loaded in to a range of [0, 1] and then normalized using mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225]. You can use the following transform to normalize:
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                 std=[0.229, 0.224, 0.225])

"
There’s no mention about not calculating them from own dataset (I never said that).



 ptrblck:

I would claim these stats work on “natural” images (or in other words ImageNet-like images) and could yield a good baseline. Your training might benefit from custom stats, but you would need to check if for your use case (and please update this thread in case you have some results).
In my experience your training might suffer, if you are using images from another domain (such as medical data), but it also depends on your use case and I don’t want to create a general assumption that it cannot work.


This is where I am confused, I cannot figure out why would there be any potential benefit at all from the custom stat. What does ImageNet mean and standard deviation has anything to do with our own datasets ? The only exception I can think of is if someone is using the pre-trained model to improve the performance of the model on ImageNet itself. Given the diversity of ImageNet, our own data has to been equally diverse on similar categories to have any sort of use for the custom state.
This is just what I think, happy to discuss further.