I am trying to combine these two mapdatasets into one. In other words, I am trying to expand my dataset.
ds = ds.map(lambda x, y: (load_aug(tf.image.resize(x, size)), y))
ds1 = ds1.map(lambda x, y: (tf.image.resize(x, size), y))
ds is an augmented version of a dataset an ds1 is a regular unaugmented dataset. The shape of the images in both datasets are the same.
CodePudding user response:
You could use zip
or concatenate
to combine both MapDatasets:
import tensorflow as tf
ds = tf.data.Dataset.range(1, 4)
ds1 = tf.data.Dataset.range(4, 8)
train_dataset = tf.data.Dataset.zip((ds, ds1))
# or
train_dataset = ds.concatenate(ds1)