Databunch normalization

I have trained a CNN from scratch on a particular dataset. During testing, I would like the same normalization metrics to be used on the testing dataset.

trainData = (ImageItemList.from_folder(trainPath).random_split_by_pct(seed=2701).label_from_folder().transform(get_transforms(),size=512).databunch(bs=15).normalize())

testData = (ImageItemList.from_folder(trainPath).no_split().label_from_folder().transform(get_transforms(),size=512).databunch(bs=20).normalize(trainData.stats))

I understand that the same normalization used for training must be applied to test data as well. Thats why I passed trainData.stats to the normalize method on testData. However, when I print testData.stats, its different from trainData.stats. Is this behaviour expected?

@roshansk did you find any answer for this question?

Maybe the reason is when you call the normalize and stats, it calls the batch_stats, which just get the stats of one batch. Not the whole dataset (If want to calculate mean and std of the whole dataset costs more time)