File size: 802 Bytes
5fa1a76 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
from tensorflow import keras from tensorflow.keras import layers size = (image_processor.size["height"], image_processor.size["width"]) train_data_augmentation = keras.Sequential( [ layers.RandomCrop(size[0], size[1]), layers.Rescaling(scale=1.0 / 127.5, offset=-1), layers.RandomFlip("horizontal"), layers.RandomRotation(factor=0.02), layers.RandomZoom(height_factor=0.2, width_factor=0.2), ], name="train_data_augmentation", ) val_data_augmentation = keras.Sequential( [ layers.CenterCrop(size[0], size[1]), layers.Rescaling(scale=1.0 / 127.5, offset=-1), ], name="val_data_augmentation", ) Next, create functions to apply appropriate transformations to a batch of images, instead of one image at a time. |