class_docstr: CrowdHuman evaluation metric.
  
  Evaluate Average Precision (AP), Miss Rate (MR) and Jaccard Index (JI)
  for detection tasks.
  
  Args:
      ann_file (str): Path to the annotation file.
      metric (str | List[str]): Metrics to be evaluated. Valid metrics
          include 'AP', 'MR' and 'JI'. Defaults to 'AP'.
      format_only (bool): Format the output results without perform
          evaluation. It is useful when you want to format the result
          to a specific format and submit it to the test server.
          Defaults to False.
      outfile_prefix (str, optional): The prefix of json files. It includes
          the file path and the prefix of filename, e.g., "a/b/prefix".
          If not specified, a temp file will be created. Defaults to None.
      file_client_args (dict, optional): Arguments to instantiate the
          corresponding backend in mmdet <= 3.0.0rc6. Defaults to None.
      backend_args (dict, optional): Arguments to instantiate the
          corresponding backend. Defaults to None.
      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. Defaults to None.
      eval_mode (int): Select the mode of evaluate. Valid mode include
          0(just body box), 1(just head box) and 2(both of them).
          Defaults to 0.
      iou_thres (float): IoU threshold. Defaults to 0.5.
      compare_matching_method (str, optional): Matching method to compare
          the detection results with the ground_truth when compute 'AP'
          and 'MR'.Valid method include VOC and None(CALTECH). Default to
          None.
      mr_ref (str): Different parameter selection to calculate MR. Valid
          ref include CALTECH_-2 and CALTECH_-4. Defaults to CALTECH_-2.
      num_ji_process (int): The number of processes to evaluation JI.
          Defaults to 10.
code: def __init__(
      self,
      ann_file: str,
      metric: Union[str, List[str]] = ["AP", "MR", "JI"],
      format_only: bool = False,
      outfile_prefix: Optional[str] = None,
      file_client_args: dict = None,
      backend_args: dict = None,
      collect_device: str = "cpu",
      prefix: Optional[str] = None,
      eval_mode: int = 0,
      iou_thres: float = 0.5,
      compare_matching_method: Optional[str] = None,
      mr_ref: str = "CALTECH_-2",
      num_ji_process: int = 10,
  ) -> None:
      super().__init__(collect_device=collect_device, prefix=prefix)
  
      self.ann_file = ann_file
      # crowdhuman evaluation metrics
      self.metrics = metric if isinstance(metric, list) else [metric]
      allowed_metrics = ["MR", "AP", "JI"]
      for metric in self.metrics:
          if metric not in allowed_metrics:
              raise KeyError(
                  f"metric should be one of 'MR', 'AP', 'JI',"
                  f"but got {metric}."
              )
  
      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.outfile_prefix = outfile_prefix
      self.backend_args = backend_args
      if file_client_args is not None:
          raise RuntimeError(
              "The `file_client_args` is deprecated, "
              "please use `backend_args` instead, please refer to"
              "https://github.com/open-mmlab/mmdetection/blob/main/configs/_base_/datasets/coco_detection.py"  # noqa: E501
          )
  
      assert eval_mode in [
          0,
          1,
          2,
      ], "Unknown eval mode. mr_ref should be one of '0', '1', '2'."
      assert (
          compare_matching_method is None
          or compare_matching_method == "VOC"
      ), (
          "The alternative compare_matching_method is VOC."
          "This parameter defaults to CALTECH(None)"
      )
      assert (
          mr_ref == "CALTECH_-2" or mr_ref == "CALTECH_-4"
      ), "mr_ref should be one of 'CALTECH_-2', 'CALTECH_-4'."
      self.eval_mode = eval_mode
      self.iou_thres = iou_thres
      self.compare_matching_method = compare_matching_method
      self.mr_ref = mr_ref
      self.num_ji_process = num_ji_process
  
imports: import copy
  import json
  import os.path
  import tempfile
  from collections import OrderedDict
  from multiprocessing import Process, Queue
  from typing import Dict, List, Optional, Sequence, Union
  import numpy
  from mmengine.evaluator import BaseMetric
  from mmengine.fileio import dump, get_text, load
  from mmengine.logging import MMLogger
  from scipy.sparse import csr_matrix
  from scipy.sparse.csgraph import maximum_bipartite_matching
  from mmdet.evaluation.functional.bbox_overlaps import bbox_overlaps
  from mmdet.registry import METRICS
label_desc: Use image node_id 1 to create a new CrowdHumanMetric object from inherited base classes: BaseMetric with example: obj = CrowdHumanMetric(ann_file, metric, format_only, outfile_prefix, file_client_args, backend_args, collect_device, prefix, eval_mode, iou_thres, compare_matching_method, mr_ref, num_ji_process)