code: def parse_xml(args):
      xml_path, img_path = args
      tree = ET.parse(xml_path)
      root = tree.getroot()
      size = root.find("size")
      w = int(size.find("width").text)
      h = int(size.find("height").text)
      bboxes = []
      labels = []
      bboxes_ignore = []
      labels_ignore = []
      for obj in root.findall("object"):
          name = obj.find("name").text
          label = label_ids[name]
          difficult = int(obj.find("difficult").text)
          bnd_box = obj.find("bndbox")
          bbox = [
              int(bnd_box.find("xmin").text),
              int(bnd_box.find("ymin").text),
              int(bnd_box.find("xmax").text),
              int(bnd_box.find("ymax").text),
          ]
          if difficult:
              bboxes_ignore.append(bbox)
              labels_ignore.append(label)
          else:
              bboxes.append(bbox)
              labels.append(label)
      if not bboxes:
          bboxes = np.zeros((0, 4))
          labels = np.zeros((0,))
      else:
          bboxes = np.array(bboxes, ndmin=2) - 1
          labels = np.array(labels)
      if not bboxes_ignore:
          bboxes_ignore = np.zeros((0, 4))
          labels_ignore = np.zeros((0,))
      else:
          bboxes_ignore = np.array(bboxes_ignore, ndmin=2) - 1
          labels_ignore = np.array(labels_ignore)
      annotation = {
          "filename": img_path,
          "width": w,
          "height": h,
          "ann": {
              "bboxes": bboxes.astype(np.float32),
              "labels": labels.astype(np.int64),
              "bboxes_ignore": bboxes_ignore.astype(np.float32),
              "labels_ignore": labels_ignore.astype(np.int64),
          },
      }
      return annotation
  
file_path: mmdetection/tools/dataset_converters/pascal_voc.py
imports: import argparse
  import os.path
  import xml.etree.ElementTree
  import numpy
  from mmengine.fileio import dump, list_from_file
  from mmengine.utils import mkdir_or_exist, track_progress
  from mmdet.evaluation import voc_classes
label_desc: Use image node_id 1 for calling a global function with example usage: parse_xml(args) and returns: annotation