code: def convert_images(dataset, image_mode):
      """Converts the images to the format required by the model.
  
      If the images are base64 encoded, they are decoded and converted to
      numpy arrays. If the images are already numpy arrays, they are
      returned as is.
  
      :param dataset: The dataset to convert.
      :type dataset: numpy.ndarray
      :param image_mode: The mode to open the image in.
          See pillow documentation for all modes:
          https://pillow.readthedocs.io/en/stable/handbook/concepts.html
      :type image_mode: str
      :return: The converted dataset.
      :rtype: numpy.ndarray
      """
      if len(dataset) > 0 and isinstance(dataset[0], str):
          try:
              dataset = np.array(
                  [get_image_from_path(x, image_mode) for x in dataset]
              )
          except ValueError:
              # if images of different sizes, try to convert one by one
              jagged = np.empty(len(dataset), dtype=object)
              for i, x in enumerate(dataset):
                  jagged[i] = get_image_from_path(x, image_mode)
              dataset = jagged
      return dataset
  
imports: import numpy
  from responsibleai_vision.common.constants import ImageColumns
  from responsibleai_vision.utils.image_reader import get_image_from_path
label_desc: Use image node_id 1 for calling a global function with example usage: convert_images(dataset, image_mode) and returns: dataset