import tensorflow as tf from tensorflow import keras import matplotlib.pyplot as plt datagen = keras.preprocessing.image.ImageDataGenerator( rescale=1./255, rotation_range=180, width_shift_range=0.2, height_shift_range=0.2, ) dir_It = datagen.flow_from_directory( "data/", batch_size=1, save_to_dir="output/", save_prefix="", save_format='png', ) for _ in range(5): img, label = dir_It.next() print(img.shape) # (1,256,256,3) plt.imshow(img[0]) plt.show()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter