code: def decode_bbox_from_caption(text, img_w, img_h, verbose=False):
      entities = []
      boxes = []
  
      start = 0
      in_brackets = False
      entity = ""
      box = ""
  
      for i, char in enumerate(text):
          if char == "[":
              in_brackets = True
              entity = text[start:i].strip()
              start = i + 1
          elif char == "]":
              in_brackets = False
              box = text[start:i].strip()
              start = i + 1
  
              # Convert box string to list of integers
              box_list = list(map(int, box.split(",")))
              resized_box_list = resize_bbox(box_list, img_w, img_h)
              entities.append(entity)
              boxes.append(resized_box_list)
  
              # Skip until the next entity (ignoring periods or other delimiters)
              while start < len(text) and text[start] not in [
                  ".",
                  ",",
                  ";",
                  "!",
                  "?",
              ]:
                  start += 1
              start += 1  # Skip the delimiter
  
      return entities, boxes
  
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 2 for calling a global function with example usage: decode_bbox_from_caption(text, img_w, img_h, verbose) and returns: entities,  boxes