I have a batch dataset which contains image as input and output. Code is like this:
os.chdir(r'E:/trainTest')
def process_img(file_path):
img = tf.io.read_file(file_path)
img = tf.image.decode_png(img, channels=3)
img = tf.image.convert_image_dtype(img, tf.float32)
img = tf.image.resize(img, size=(img_height, img_width))
return img
x_files = glob('input/*.png')
y_files = glob('output/*.png')
files_ds = tf.data.Dataset.from_tensor_slices((x_files, y_files))
#Dataset which gives me input-output
files_ds = files_ds.map(lambda x, y: (process_img(x), process_img(y))).batch(batch_size)
#model init etc
#----
model.fit(files_ds,epochs=25)
Problem is I don't have enough images for my model. So my question is, how can i create augmented images (like flipped, rotated, zoomed etc) from files_ds
? Because the output image has to be augmented the same way the input image is augmented.
This question actually arrived from the following question and i wanted to ask this in its own section:
Tensorflow image_dataset_from_directory for input dataset and output dataset