Inference Learner: imagenet_stats and load_learner

Hello all,

According to https://docs.fast.ai/tutorial.inference.html, we could infer on an entire test dataset using the following:
learner = load_learner(path='path/to/pickled/learner/object', file='picklefile.pkl', test=ImageList.from_folder(test_dataset_path)

And then…
preds, _ = learner.get_preds(ds_type=DatasetType.Test)

If I’d have trained the model on images normalized using imagenet statistics, would the load_learner() load the test images as a Pytorch dataloader which is also normalized on the imagenet statistics?

The manual says so.

I went through the code as well in the forums, but did not get a clear opinion.

learner.data.stats does show the mean and standard deviation identical to the imagenet statistics that is used.

Can someone confirm?

1 Like