code: def get_gt_boxes_from_txt(gt_path, cache_dir):
      cache_file = os.path.join(cache_dir, "gt_cache.pkl")
      if os.path.exists(cache_file):
          with open(cache_file, "rb") as f:
              boxes = pickle.load(f)
          return boxes
  
      f = open(gt_path, "r")
      state = 0
      lines = f.readlines()
      lines = list(map(lambda x: x.rstrip("\r\n"), lines))
      boxes = {}
      # print(len(lines))
      f.close()
      current_boxes = []
      current_name = None
      for line in lines:
          if state == 0 and "--" in line:
              state = 1
              current_name = line
              continue
          if state == 1:
              state = 2
              continue
  
          if state == 2 and "--" in line:
              state = 1
              boxes[current_name] = np.array(current_boxes).astype(
                  "float32"
              )
              current_name = line
              current_boxes = []
              continue
  
          if state == 2:
              box = [float(x) for x in line.split(" ")[:4]]
              current_boxes.append(box)
              continue
  
      with open(cache_file, "wb") as f:
          pickle.dump(boxes, f)
      return boxes
  
imports: from __future__ import absolute_import
  import os
  import tqdm
  import pickle
  import datetime
  import argparse
  import numpy
  from scipy.io import loadmat
label_desc: Use image node_id 7 for calling a global function with example usage: get_gt_boxes_from_txt(gt_path, cache_dir) and returns: boxes, boxes