I have a folder with images of different sizes. I tried using ImageDataGenerator with flow_from_directory to batch load / expand data.
Is there a way to keep the proportions of my images? It seems that the images are stretched to target_size: I would like to โoverlayโ my images without warping them (filling in the blanks with a constant value)
Here is my code:
datagen = ImageDataGenerator(
rescale = 1./255,
fill_mode='constant')
generator = datagen.flow_from_directory(
'data/images',
target_size=(256,256),
color_mode = 'grayscale',
batch_size=99,
class_mode=None,
shuffle=False)
Images are stretched to (256,256).
LeWiZ source
share