code: def save_mtmct_vis_results(
      camera_results, captures, output_dir, multi_res=None
  ):
      # camera_results: 'cid, tid, fid, x1, y1, w, h'
      camera_ids = list(camera_results.keys())
  
      import shutil
  
      save_dir = os.path.join(output_dir, "mtmct_vis")
      if os.path.exists(save_dir):
          shutil.rmtree(save_dir)
      os.makedirs(save_dir)
  
      for idx, video_file in enumerate(captures):
          capture = cv2.VideoCapture(video_file)
          cid = camera_ids[idx]
          basename = os.path.basename(video_file)
          video_out_name = "vis_" + basename
          out_path = os.path.join(save_dir, video_out_name)
          print("Start visualizing output video: {}".format(out_path))
  
          # Get Video info : resolution, fps, frame count
          width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH))
          height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT))
          fps = int(capture.get(cv2.CAP_PROP_FPS))
          frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
          fourcc = cv2.VideoWriter_fourcc(*"mp4v")
          writer = cv2.VideoWriter(
              out_path, fourcc, fps, (width, height)
          )
          frame_id = 0
          while 1:
              if frame_id % 50 == 0:
                  print("frame id: ", frame_id)
              ret, frame = capture.read()
              frame_id += 1
              if not ret:
                  if frame_id == 1:
                      print("video read failed!")
                  break
              frame_results = camera_results[cid][
                  camera_results[cid][:, 2] == frame_id
              ]
              boxes = frame_results[:, -4:]
              ids = frame_results[:, 1]
              image = plot_tracking(
                  frame, boxes, ids, frame_id=frame_id, fps=fps
              )
  
              # add attr vis
              if multi_res:
                  tid_list = multi_res.keys()  # c0_t1, c0_t2...
                  all_attr_result = [
                      multi_res[i]["attrs"] for i in tid_list
                  ]  # all cid_tid result
                  if any(
                      all_attr_result
                  ):  # at least one cid_tid[attrs] is not None will goes to attrs_vis
                      attr_res = []
                      cid_str = "c" + str(cid - 1) + "_"
                      for k in tid_list:
                          if not k.startswith(cid_str):
                              continue
                          if (frame_id - 1) >= len(
                              multi_res[k]["attrs"]
                          ):
                              t_attr = None
                          else:
                              t_attr = multi_res[k]["attrs"][
                                  frame_id - 1
                              ]
                              attr_res.append(t_attr)
                      assert len(attr_res) == len(boxes)
                      image = visualize_attr(
                          image, attr_res, boxes, is_mtmct=True
                      )
  
              writer.write(image)
          writer.release()
  
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 3 for calling a global function with example usage: save_mtmct_vis_results(camera_results, captures, output_dir, multi_res) without return types