0

I'm new to Image Processing/ Classification so I'm sorry if this is common knowledge. How do I decide which of ImageDataGenerator parameters/ features I should implement on my dataset? There are quite a few parameters in ImageDataGenerator,

tf.keras.preprocessing.image.ImageDataGenerator(
    featurewise_center=False,
    samplewise_center=False,
    featurewise_std_normalization=False,
    samplewise_std_normalization=False,
    zca_whitening=False,
    zca_epsilon=1e-06,
    rotation_range=0,
    width_shift_range=0.0,
    height_shift_range=0.0,
    brightness_range=None,
    shear_range=0.0,
    zoom_range=0.0,
    channel_shift_range=0.0,
    fill_mode='nearest',
    cval=0.0,
    horizontal_flip=False,
    vertical_flip=False,
    rescale=None,
    preprocessing_function=None,
    data_format=None,
    validation_split=0.0,
    interpolation_order=1,
    dtype=None
)

I know a few things like,

    rescale=1.0/255,                # Rescale pixel values to [0, 1]
    rotation_range=20,              # Random rotation within 20 degrees
    width_shift_range=0.2,          # Random horizontal shift by 20% of image width
    height_shift_range=0.2,         # Random vertical shift by 20% of image height
    horizontal_flip=True,           # Random horizontal flipping
    fill_mode='nearest'             # Fill mode for new pixels after shifts/rotations

I'm not sure about the rest of the parameters. I understand that every dataset is different and needs to be processed according to it's features and the task at hand. But, I would like to understand what I'm doing/ what else could be done.

Thank you.

I'm currently working on a Dogs & Cats Images dataset and I want to classify the images using tensorflow. Implementing ImageDataGenerator has been confusing.

2
  • ImageDataGenerator is deprecated and you should use the alternative mentioned in this answer. Strangely, the alternative is not mentioned in the official docs anymore. As for your question, you can see a few examples of augmentation here. Commented Apr 29, 2024 at 8:10
  • Data augmentation in Keras, using the ImageDataGenerator, applies random transformations to images to increase dataset diversity. Key parameters include rotation_range (for rotations), height_shift_range (for shifts), shear_range (for shearing), and zoom_range (for zooming). You can also flip images horizontally (horizontal_flip) or vertically (vertical_flip), and adjust brightness with brightness_range. These augmentations help prevent overfitting and improve model generalization. The generator integrates into training loops, making it a powerful tool for working with limited data. Commented Nov 21, 2024 at 9:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.