code: def load_fridge_object_detection_dataset_labels():
      """Loads the labels for the fridge object detection dataset.
  
      return: list of labels
      rtype: list
      """
  
      src_images = "./data/odFridgeObjects/"
  
      # Path to the annotations
      annotations_folder = os.path.join(src_images, "annotations")
  
      labels = []
      label_dict = {
          "can": 1,
          "carton": 2,
          "milk_bottle": 3,
          "water_bottle": 4,
      }
  
      # Read each annotation
      for _, filename in enumerate(os.listdir(annotations_folder)):
          if filename.endswith(".xml"):
              print("Parsing " + os.path.join(src_images, filename))
  
              root = ET.parse(
                  os.path.join(annotations_folder, filename)
              ).getroot()
  
              # use if needed
              # width = int(root.find("size/width").text)
              # height = int(root.find("size/height").text)
  
              image_labels = []
              for object in root.findall("object"):
                  name = object.find("name").text
                  xmin = object.find("bndbox/xmin").text
                  ymin = object.find("bndbox/ymin").text
                  xmax = object.find("bndbox/xmax").text
                  ymax = object.find("bndbox/ymax").text
                  isCrowd = int(object.find("difficult").text)
                  image_labels.append(
                      [
                          label_dict[name],  # label
                          float(
                              xmin
                          ),  # topX. To normalize, divide by width.
                          float(
                              ymin
                          ),  # topY. To normalize, divide by height.
                          float(
                              xmax
                          ),  # bottomX. To normalize, divide by width
                          float(
                              ymax
                          ),  # bottomY. To normalize, divide by height
                          int(isCrowd),
                      ]
                  )
              labels.append(image_labels)
  
      return labels
  
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 5 for calling a global function with example usage: load_fridge_object_detection_dataset_labels() and returns: labels