class_docstr: mAP and CMC evaluation metrics for the ReID task.
  
  Args:
      metric (str | list[str]): Metrics to be evaluated.
          Default value is `mAP`.
      metric_options: (dict, optional): Options for calculating metrics.
          Allowed keys are 'rank_list' and 'max_rank'. 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. Default: None
code: def __init__(
      self,
      metric: Union[str, Sequence[str]] = "mAP",
      metric_options: Optional[dict] = None,
      collect_device: str = "cpu",
      prefix: Optional[str] = None,
  ) -> None:
      super().__init__(collect_device, prefix)
  
      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.metric_options = metric_options or dict(
          rank_list=[1, 5, 10, 20], max_rank=20
      )
      for rank in self.metric_options["rank_list"]:
          assert 1 <= rank <= self.metric_options["max_rank"]
  
file_path: mmdetection/mmdet/evaluation/metrics/reid_metric.py
imports: from typing import Optional, Sequence, Union
  import numpy
  import torch
  from mmengine.evaluator import BaseMetric
  from mmdet.registry import METRICS
label_desc: Use image node_id 1 to create a new ReIDMetrics object from inherited base classes: BaseMetric with example: obj = ReIDMetrics(metric, metric_options, collect_device, prefix)