class_docstr: Evaluation metrics for MOT Challenge.
  
  Args:
      metric (str | list[str]): Metrics to be evaluated. Options are
          'HOTA', 'CLEAR', 'Identity'.
          Defaults to ['HOTA', 'CLEAR', 'Identity'].
      outfile_prefix (str, optional): Path to save the formatted results.
          Defaults to None.
      track_iou_thr (float): IoU threshold for tracking evaluation.
          Defaults to 0.5.
      benchmark (str): Benchmark to be evaluated. Defaults to 'MOT17'.
      format_only (bool): If True, only formatting the results to the
          official format and not performing evaluation. Defaults to False.
      postprocess_tracklet_cfg (List[dict], optional): configs for tracklets
          postprocessing methods. `InterpolateTracklets` is supported.
          Defaults to []
          - InterpolateTracklets:
              - min_num_frames (int, optional): The minimum length of a
                  track that will be interpolated. Defaults to 5.
              - max_num_frames (int, optional): The maximum disconnected
                  length in a track. Defaults to 20.
              - use_gsi (bool, optional): Whether to use the GSI (Gaussian-
                  smoothed interpolation) method. Defaults to False.
              - smooth_tau (int, optional): smoothing parameter in GSI.
                  Defaults to 10.
      collect_device (str): Device name used for collecting results from
          different ranks during distributed training. Must be 'cpu' or
          'gpu'. Defaults to 'cpu'.
      prefix (str, optional): The prefix that will be added in the metric
          names to disambiguate homonymous metrics of different evaluators.
          If prefix is not provided in the argument, self.default_prefix
          will be used instead. Default: None
  Returns:
class_docstr_tok: ["Evaluation","metrics","for","MOT","Challenge",".","Args",":","metric","(","str","|","list","[","str","]",")",":","Metrics","to","be","evaluated",".","Options","are","'HOTA","'",",","'CLEAR","'",",","'Identity","'",".","Defaults","to","[","'HOTA","'",",","'CLEAR","'",",","'Identity","'","]",".","outfile_prefix","(","str",",","optional",")",":","Path","to","save","the","formatted","results",".","Defaults","to","None",".","track_iou_thr","(","float",")",":","IoU","threshold","for","tracking","evaluation",".","Defaults","to","0.5.","benchmark","(","str",")",":","Benchmark","to","be","evaluated",".","Defaults","to","'MOT17","'",".","format_only","(","bool",")",":","If","True",",","only","formatting","the","results","to","the","official","format","and","not","performing","evaluation",".","Defaults","to","False",".","postprocess_tracklet_cfg","(","List","[","dict","]",",","optional",")",":","configs","for","tracklets","postprocessing","methods",".","`","InterpolateTracklets","`","is","supported",".","Defaults","to","[","]","-","InterpolateTracklets",":","-","min_num_frames","(","int",",","optional",")",":","The","minimum","length","of","a","track","that","will","be","interpolated",".","Defaults","to","5",".","-","max_num_frames","(","int",",","optional",")",":","The","maximum","disconnected","length","in","a","track",".","Defaults","to","20",".","-","use_gsi","(","bool",",","optional",")",":","Whether","to","use","the","GSI","(","Gaussian-","smoothed","interpolation",")","method",".","Defaults","to","False",".","-","smooth_tau","(","int",",","optional",")",":","smoothing","parameter","in","GSI",".","Defaults","to","10.","collect_device","(","str",")",":","Device","name","used","for","collecting","results","from","different","ranks","during","distributed","training",".","Must","be","'cpu","'","or","'gpu","'",".","Defaults","to","'cpu","'",".","prefix","(","str",",","optional",")",":","The","prefix","that","will","be","added","in","the","metric","names","to","disambiguate","homonymous","metrics","of","different","evaluators",".","If","prefix","is","not","provided","in","the","argument",",","self.default_prefix","will","be","used","instead",".","Default",":","None","Returns",":"]
code: def __init__(
      self,
      metric: Union[str, List[str]] = ["HOTA", "CLEAR", "Identity"],
      outfile_prefix: Optional[str] = None,
      track_iou_thr: float = 0.5,
      benchmark: str = "MOT17",
      format_only: bool = False,
      use_postprocess: bool = False,
      postprocess_tracklet_cfg: Optional[List[dict]] = [],
      collect_device: str = "cpu",
      prefix: Optional[str] = None,
  ) -> None:
      super().__init__(collect_device=collect_device, prefix=prefix)
      if trackeval is None:
          raise RuntimeError(
              "trackeval is not installed,"
              "please install it by: pip install"
              "git+https://github.com/JonathonLuiten/TrackEval.git"
              "trackeval need low version numpy, please install it"
              "by: pip install -U numpy==1.23.5"
          )
      if isinstance(metric, list):
          metrics = metric
      elif isinstance(metric, str):
          metrics = [metric]
      else:
          raise TypeError("metric must be a list or a str.")
      for metric in metrics:
          if metric not in self.allowed_metrics:
              raise KeyError(f"metric {metric} is not supported.")
      self.metrics = metrics
      self.format_only = format_only
      if self.format_only:
          assert (
              outfile_prefix is not None
          ), "outfile_prefix must be not"
          "None when format_only is True, otherwise the result files will"
          "be saved to a temp directory which will be cleaned up at the end."
      self.use_postprocess = use_postprocess
      self.postprocess_tracklet_cfg = postprocess_tracklet_cfg.copy()
      self.postprocess_tracklet_methods = [
          TASK_UTILS.build(cfg) for cfg in self.postprocess_tracklet_cfg
      ]
      assert benchmark in self.allowed_benchmarks
      self.benchmark = benchmark
      self.track_iou_thr = track_iou_thr
      self.tmp_dir = tempfile.TemporaryDirectory()
      self.tmp_dir.name = get_tmpdir()
      self.seq_info = defaultdict(
          lambda: dict(seq_length=-1, gt_tracks=[], pred_tracks=[])
      )
      self.gt_dir = self._get_gt_dir()
      self.pred_dir = self._get_pred_dir(outfile_prefix)
      self.seqmap = osp.join(self.pred_dir, "videoseq.txt")
      with open(self.seqmap, "w") as f:
          f.write("name\n")
  
imports: import os
  import os.path
  import shutil
  import tempfile
  from collections import defaultdict
  from typing import List, Optional, Union
  import numpy
  import torch
  from mmengine.dist import all_gather_object, barrier, broadcast, broadcast_object_list, get_dist_info, is_main_process
  from mmengine.logging import MMLogger
  from mmdet.registry import METRICS, TASK_UTILS
  from .base_video_metric import BaseVideoMetric
label_desc: Use image node_id 1 to create a new MOTChallengeMetric object from inherited base classes: BaseVideoMetric with example: obj = MOTChallengeMetric(metric, outfile_prefix, track_iou_thr, benchmark, format_only, use_postprocess, postprocess_tracklet_cfg, collect_device, prefix)