Databunch normalization

(Roshan Santhosh) #1

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?

0 Likes

#2

@roshansk did you find any answer for this question?

0 Likes