class_docstr: Pascal VOC evaluation metric.
  
  Args:
      iou_thrs (float or List[float]): IoU threshold. Defaults to 0.5.
      scale_ranges (List[tuple], optional): Scale ranges for evaluating
          mAP. If not specified, all bounding boxes would be included in
          evaluation. Defaults to None.
      metric (str | list[str]): Metrics to be evaluated. Options are
          'mAP', 'recall'. If is list, the first setting in the list will
           be used to evaluate metric.
      proposal_nums (Sequence[int]): Proposal number used for evaluating
          recalls, such as recall@100, recall@1000.
          Default: (100, 300, 1000).
      eval_mode (str): 'area' or '11points', 'area' means calculating the
          area under precision-recall curve, '11points' means calculating
          the average precision of recalls at [0, 0.1, ..., 1].
          The PASCAL VOC2007 defaults to use '11points', while PASCAL
          VOC2012 defaults to use 'area'.
      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.
code: def __init__(
      self,
      iou_thrs: Union[float, List[float]] = 0.5,
      scale_ranges: Optional[List[tuple]] = None,
      metric: Union[str, List[str]] = "mAP",
      proposal_nums: Sequence[int] = (100, 300, 1000),
      eval_mode: str = "11points",
      collect_device: str = "cpu",
      prefix: Optional[str] = None,
  ) -> None:
      super().__init__(collect_device=collect_device, prefix=prefix)
      self.iou_thrs = (
          [iou_thrs] if isinstance(iou_thrs, float) else iou_thrs
      )
      self.scale_ranges = scale_ranges
      # voc evaluation metrics
      if not isinstance(metric, str):
          assert len(metric) == 1
          metric = metric[0]
      allowed_metrics = ["recall", "mAP"]
      if metric not in allowed_metrics:
          raise KeyError(
              f"metric should be one of 'recall', 'mAP', but got {metric}."
          )
      self.metric = metric
      self.proposal_nums = proposal_nums
      assert eval_mode in [
          "area",
          "11points",
      ], 'Unrecognized mode, only "area" and "11points" are supported'
      self.eval_mode = eval_mode
  
file_path: mmdetection/mmdet/evaluation/metrics/voc_metric.py
imports: import copy
  import warnings
  from collections import OrderedDict
  from typing import List, Optional, Sequence, Union
  import numpy
  from mmengine.evaluator import BaseMetric
  from mmengine.logging import MMLogger
  from mmdet.registry import METRICS
  from ..functional import eval_map, eval_recalls
label_desc: Use image node_id 1 to create a new VOCMetric object from inherited base classes: BaseMetric with example: obj = VOCMetric(iou_thrs, scale_ranges, metric, proposal_nums, eval_mode, collect_device, prefix)