MIC-DKFZ / batchgenerators

A framework for data augmentation for 2D and 3D image classification and segmentation
Apache License 2.0
1.09k stars 221 forks source link

Questions about adding Normalization as data augmentation #76

Closed QiushiYang closed 3 years ago

QiushiYang commented 3 years ago

According to the function: get_train_transform of brats2017_dataloader_3D.py, it seems that there is no Normalization for the inputs after all the other augmentation operations. Wonder why and whether it will be useful to add the normalizaiton as the final step of augmentation? Also, another question is that is it reasonable to add GaussianNoiseTransform as a kind of augmentation? (Considering that in the testing data, it seems that there is no much Gaussian noises actually.)

FabianIsensee commented 3 years ago

Do not use batchgenerators for inference. Batchgenerators is for training only. The normalization is part of the preprocessing. This computation is done beforehand. It makes no sense to repeat this over and over again on the fly and waste computation time ;-)

QiushiYang commented 3 years ago

Thank you so much for your so quick helps. I have another question that will it be more useful to do data augmentation offline beforehand to get a stable training process than doing it on the fly?

FabianIsensee commented 3 years ago

Always on the fly! This allows you to get an infinite number of augmented samples. Never run data augmentation offline! This has no effect on stability

QiushiYang commented 3 years ago

Thanks a lot! I will have a try again.