Skip to main content
100%

configure random transformations and normalization operations to be done on your image data during training

✓ Published0🌍 Public
Aabehmiel
Last edited Aug 3, 2017
Created on Aug 3, 2017

The example demonstrates how Keras’s `ImageDataGenerator` applies random geometric transformations and normalization to a single input image, producing a grid of augmented variations saved as JPEG files. It shows the effects of rotation, width and height shifts, shear, zoom, and horizontal flipping on a cat photo, with pixel fill mode set to nearest. The code loads an image via `load_img`, converts it to a NumPy array with `img_to_array`, reshapes it into a batch, and then uses the generator’s `.flow()` method to generate and save 20 preview images to a directory. The approach relies entirely on Keras’s preprocessing API, with no custom data source or rendering.

AI-generated description

Similar vizzes