In the end this API is just going to dataset map over load_image that it is a multiple call over tf.image.decode_image so you don’t have any parameter to do it internally.

  

      github.com
  

  
    keras-team/keras/blob/41c992105fdc0f0d00e7618752f36e0884f8e5c9/keras/preprocessing/image_dataset.py#L251



      
      
                                          labels,
                                          label_mode,
                                          num_classes,
                                          interpolation,
                                          crop_to_aspect_ratio=False):
            """Constructs a dataset of images and labels."""
            # TODO(fchollet): consider making num_parallel_calls settable
            path_ds = tf.data.Dataset.from_tensor_slices(image_paths)
            args = (image_size, num_channels, interpolation, crop_to_aspect_ratio)
            img_ds = path_ds.map(
                lambda x: load_image(x, *args), num_parallel_calls=tf.data.AUTOTUNE)
            if label_mode:
              label_ds = dataset_utils.labels_to_dataset(labels, label_mode, num_classes)
              img_ds = tf.data.Dataset.zip((img_ds, label_ds))
            return img_ds
          
          

          
def load_image(path, image_size, num_channels, interpolation,
                         crop_to_aspect_ratio=False):
            """Load an image from a path and resize it."""
            img = tf.io.read_file(path)