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
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.
    
detection/tools/analysis_tools/mot/mot_error_visualize.py