For a set of images, I was confused if the term Data Augmentation meant to transform the current dataset (e.g. crop/flip/rotate/...) or if it meant to increase the amount of data by adding the cropped/flipped/rotated images to the initial dataset. As far as I understand, from this question and this one, it means both. Please correct me if I'm wrong.
So, using Tensorflow Dataset, I want to achieve the second one: augmenting the amount of data.
I'm using the ImageNet data from TFDS (trainning set is not available):
import tensorflow_datasets as tfds
ds = tfds.load('imagenet_a', split='test', as_supervised=True)
And I want to flip the images:
def transform(image, label):
image = tf.image.flip_left_right(image)
return image, label
It works well if I apply the transformation directly to the dataset. But it doesn't increase the amount of data:
ds = ds.map(transform)
So, I tried to create a second dataset and concatenate both:
ds0 = ds.map(transform)
ds = ds.concatenate(ds0)
But I get the following error:
TypeError: Two datasets to concatenate have different types (tf.uint8, tf.int64) and (tf.float32, tf.int64)
Is it the way to do to concatenate two datasets to increase a training set? Or how to do it correctly? (or how to fix my error)
I'm aware of ImageDataGenerator, but it doesn't contain the transformation I want