code: def get_annotations(
      filename,
  ) -> Dict[str, Union[int, List[str], Dict[str, List[List[int]]]]]:
      """
      Parses the xml files in the Flickr30K Entities dataset
  
      input:
        filename - full file path to the annotations file to parse
  
      output:
        dictionary with the following fields:
            scene - list of identifiers which were annotated as
                    pertaining to the whole scene
            nobox - list of identifiers which were annotated as
                    not being visible in the image
            boxes - a dictionary where the fields are identifiers
                    and the values are its list of boxes in the
                    [xmin ymin xmax ymax] format
            height - int representing the height of the image
            width - int representing the width of the image
            depth - int representing the depth of the image
      """
      tree = ET.parse(filename)
      root = tree.getroot()
      size_container = root.findall("size")[0]
      anno_info: Dict[
          str, Union[int, List[str], Dict[str, List[List[int]]]]
      ] = {}
      all_boxes: Dict[str, List[List[int]]] = {}
      all_noboxes: List[str] = []
      all_scenes: List[str] = []
      for size_element in size_container:
          assert size_element.text
          anno_info[size_element.tag] = int(size_element.text)
  
      for object_container in root.findall("object"):
          for names in object_container.findall("name"):
              box_id = names.text
              assert box_id
              box_container = object_container.findall("bndbox")
              if len(box_container) > 0:
                  if box_id not in all_boxes:
                      all_boxes[box_id] = []
                  xmin = int(box_container[0].findall("xmin")[0].text)
                  ymin = int(box_container[0].findall("ymin")[0].text)
                  xmax = int(box_container[0].findall("xmax")[0].text)
                  ymax = int(box_container[0].findall("ymax")[0].text)
                  all_boxes[box_id].append([xmin, ymin, xmax, ymax])
              else:
                  nobndbox = int(
                      object_container.findall("nobndbox")[0].text
                  )
                  if nobndbox > 0:
                      all_noboxes.append(box_id)
  
                  scene = int(object_container.findall("scene")[0].text)
                  if scene > 0:
                      all_scenes.append(box_id)
      anno_info["boxes"] = all_boxes
      anno_info["nobox"] = all_noboxes
      anno_info["scene"] = all_scenes
  
      return anno_info
  
imports: import xml.etree.ElementTree
  from collections import defaultdict
  from pathlib import Path
  from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
  import numpy
  from prettytable import PrettyTable
  from tqdm import tqdm
  import json
  import os
  import re
label_desc: Use image node_id 5 for calling a global function with example usage: get_annotations(filename) and returns: anno_info