code: def compare_res_gts(
      results_dir: str, dataset: Dataset, video_name: str
  ):
      """Evaluate the results of the video.
  
      Args:
          results_dir (str): the directory of the MOT results.
          dataset (Dataset): MOT dataset of the video to be evaluated.
          video_name (str): Name of the video to be evaluated.
  
      Returns:
          tuple: (acc, res, gt), acc contains the results of MOT metrics,
          res is the results of inference and gt is the ground truth.
      """
      if "half-train" in dataset.ann_file:
          gt_file = osp.join(
              dataset.data_prefix["img_path"],
              f"{video_name}/gt/gt_half-train.txt",
          )
          gt = mm.io.loadtxt(gt_file)
          gt.index = gt.index.set_levels(
              pd.factorize(gt.index.levels[0])[0] + 1, level=0
          )
      elif "half-val" in dataset.ann_file:
          gt_file = osp.join(
              dataset.data_prefix["img_path"],
              f"{video_name}/gt/gt_half-val.txt",
          )
          gt = mm.io.loadtxt(gt_file)
          gt.index = gt.index.set_levels(
              pd.factorize(gt.index.levels[0])[0] + 1, level=0
          )
      else:
          gt_file = osp.join(
              dataset.data_prefix["img_path"], f"{video_name}/gt/gt.txt"
          )
          gt = mm.io.loadtxt(gt_file)
          gt.index = gt.index.set_levels(
              pd.factorize(gt.index.levels[0])[0] + 1, level=0
          )
      res_file = osp.join(results_dir, f"{video_name}.txt")
      res = mm.io.loadtxt(res_file)
      ini_file = osp.join(
          dataset.data_prefix["img_path"], f"{video_name}/seqinfo.ini"
      )
      if osp.exists(ini_file):
          acc, _ = mm.utils.CLEAR_MOT_M(gt, res, ini_file)
      else:
          acc = mm.utils.compare_to_groundtruth(gt, res)
  
      return acc, res, gt
  
file_path: mmdetection/tools/analysis_tools/mot/mot_error_visualize.py
imports: import argparse
  import os
  import os.path
  import re
  import mmcv
  import motmetrics
  import numpy
  import pandas
  from mmengine import Config
  from mmengine.logging import print_log
  from mmengine.registry import init_default_scope
  from torch.utils.data import Dataset
  from mmdet.registry import DATASETS
  from mmdet.utils import imshow_mot_errors
label_desc: Use image node_id 2 for calling a global function with example usage: compare_res_gts(results_dir, dataset, video_name) and returns: acc,  res,  gt