Bernardo Cecchetto
Bernardo Cecchetto

Reputation: 71

Data Augmentation

I am working with data augmentation using ImageDataGenerator(). But I am generating too many images. Is there any way that I can put a limit to the number of images that will be generated from 1 image?

Upvotes: 0

Views: 138

Answers (1)

LazyAnalyst
LazyAnalyst

Reputation: 484

Keras ImageDataGenerator will apply data augmentations to all images per batch, only once.

For example, If your batch size is 32, then ImageDataGenerator will take 32 images and apply data augmentations to every image, so that You finally get 32 images that differ from the original ones.

If you'd like to generate less images from 1 image, You can try to adjust the augmentation parameters, so that the generated images don't differ a lot from the original one. For example:

data_gen = ImageDataGenerator(
    zoom_range=0.1,
    shear_range=0.1
    rotation_range=10,
)

You know that rotating an image 10 degrees, most of the times will result in pretty much the same image as the original.

Upvotes: 2

Related Questions