Skip to content Skip to sidebar Skip to footer

Tensorflow Datasets Reshape Images

I want to build a data pipeline using tensorflow dataset. Because each data has different shapes, I can't build a data pipeline. import tensorflow_datasets as tfds import tensorflo

Solution 1:

You can dynamically resize the images like:

train_data = train_data.map(lambda image: tf.image.resize_image_with_crop_or_pad(image, 224, 224))

right before doing train_data = train_data.repeat().batch(32). Also, using the tf.data.Dataset.map(...) method you can apply a variety of transformations on your images before batching them.

Post a Comment for "Tensorflow Datasets Reshape Images"