keras-team / keras-preprocessing

Utilities for working with image data, text data, and sequence data.
Other
1.02k stars 444 forks source link

Q: how to turn off automatic data augmentation of ImageDataGenerator? #329

Open mw66 opened 3 years ago

mw66 commented 3 years ago

when I don't set any parameter to the ImageDataGenerator, e.g.

      trn_datagen = ImageDataGenerator()

I still found tmp files are written to (trn_datagen.flow_from_dataframe) save_to_dir.

But I do not want the ImageDataGenerator perform any data augmentation.

I will do it all by myself in my problem domain, and just provide the filenames to flow_from_dataframe, and want the ImageDataGenerator just use those files as it is.

1) Is there any option I can completely turn off automatic data augmentation of ImageDataGenerator?

2) a related question: do I need to do this rescale? what's the difference between setting, or not setting rescale?

      trn_datagen = ImageDataGenerator(rescale=1.0/255.0)

If I set this rescale, is it the only transformation that ImageDataGenerator will perform? and does this rescale also count as data augmentation?

I want to distinguish between two set of operations: -- transformation:, e.g. rescale user explicitly choose to do so, which does not actually change the input data. -- augmentation: e.g. rotate, or flip, which actually change the input image, and does not make any sense in my problem domain (and crop image is big NO NO).

I my problem domain, I want completely disable data augmentation, and I will explicitly do data transformation myself.

So what's the flags I should pass to ImageDataGenerator?

Thanks.