code: def load_image(
      path,
      image_size,
      num_channels,
      interpolation,
      data_format,
      crop_to_aspect_ratio=False,
  ):
      """Load an image from a path and resize it."""
      img = tf.io.read_file(path)
      img = tf.image.decode_image(
          img, channels=num_channels, expand_animations=False
      )
      if crop_to_aspect_ratio:
          from keras.backend import tensorflow as tf_backend
  
          if data_format == "channels_first":
              img = tf.transpose(img, (2, 0, 1))
          img = image_utils.smart_resize(
              img,
              image_size,
              interpolation=interpolation,
              data_format=data_format,
              backend_module=tf_backend,
          )
      else:
          img = tf.image.resize(img, image_size, method=interpolation)
          if data_format == "channels_first":
              img = tf.transpose(img, (2, 0, 1))
      if data_format == "channels_last":
          img.set_shape((image_size[0], image_size[1], num_channels))
      else:
          img.set_shape((num_channels, image_size[0], image_size[1]))
      return img
  
file_path: keras/keras/utils/image_dataset_utils.py
imports: import numpy
  from keras.api_export import keras_export
  from keras.backend.config import standardize_data_format
  from keras.utils import dataset_utils
  from keras.utils import image_utils
  from keras.utils.module_utils import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: load_image(path, image_size, num_channels, interpolation, data_format, crop_to_aspect_ratio) and returns: img