I have the following data reading utility:
def read_files(image_path, text_path):
image = tf.io.read_file(image_path)
image = tf.image.decode_jpeg(image, channels=3)
image = tf.image.resize(image, IMG_SZ, antialias=True)
text = tf.io.read_file(text_path)
text = tf.compat.as_str_any(text)
return image, text
This is how I am constructing the dataset:
dataset = tf.data.Dataset.zip((image_ds, text_ds))
dataset = dataset.map(read_files, num_parallel_calls=AUTO).cache()
Is there a way to interleave the read_files()
function?