I would like to use this function in TensorFlow, however it operates on 3D tensors rather than 4D tensors: I have an outer dimension of batch_size.
tf.image.random_flip_left_right(input_image_data)
That said, this function expects a tensor (image) of shape:
(width, height, channels)
But I have multiple images such as:
(batch_size, width, height, channels)
How could I map the random flip function to each image in my batch size and get as an output a tensor with the same 4D shape I already have?
My guess is that it would need a reshape at the entry of the function and a reshape after the function, but I am not sure whether or not this would break the data's structure and blend together images in the batch when applying the mirror. Moreover, this approach would do a single randomization on the whole batch rather than on a per-image basis.
Any suggestion appreciated!