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
  
file_path: responsible-ai-toolbox/rai_test_utils/rai_test_utils/datasets/vision/object_detection_data_utils.py
imports: import os
  import urllib.request
  import xml.etree.ElementTree
  from io import BytesIO
  from urllib.parse import urlparse
  from zipfile import ZipFile
  import numpy
  import pandas
  import requests
  from PIL import Image
  from requests.adapters import HTTPAdapter
  from requests.packages.urllib3.util.retry import Retry
label_desc: Use image node_id 3 for calling a global function with example usage: convert_images(dataset, image_mode) and returns: dataset