code: def gen_restxt(output_dir_filename, map_tid, cid_tid_dict):
      pattern = re.compile(r"c(\d)_t(\d)")
      f_w = open(output_dir_filename, "w")
      for key, res in cid_tid_dict.items():
          cid, tid = pattern.search(key).groups()
          cid = int(cid) + 1
          rects = res["rects"]
          frames = res["frames"]
          for idx, bbox in enumerate(rects):
              bbox[0][3:] -= bbox[0][1:3]
              fid = frames[idx] + 1
              rect = [max(int(x), 0) for x in bbox[0][1:]]
              if key in map_tid:
                  new_tid = map_tid[key]
                  f_w.write(
                      str(cid)
                      + " "
                      + str(new_tid)
                      + " "
                      + str(fid)
                      + " "
                      + " ".join(map(str, rect))
                      + "\n"
                  )
      print("gen_res: write file in {}".format(output_dir_filename))
      f_w.close()
  
imports: from pptracking.python.mot.visualize import plot_tracking
  from python.visualize import visualize_attr
  import os
  import re
  import cv2
  import gc
  import numpy
  import pandas
  from tqdm import tqdm
  from functools import reduce
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: gen_restxt(output_dir_filename, map_tid, cid_tid_dict) without return types