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.
docstr: Process one batch of data samples and predictions. The processed
  results should be stored in ``self.results``, which will be used to
  compute the metrics when all batches have been processed.
  
  Args:
      data_batch (dict): A batch of data from the dataloader.
      data_samples (Sequence[dict]): A batch of data samples that
          contain annotations and predictions.
docstr_tok: ["Process","one","batch","of","data","samples","and","predictions",".","The","processed","results","should","be","stored","in","``","self.results","``",",","which","will","be","used","to","compute","the","metrics","when","all","batches","have","been","processed",".","Args",":","data_batch","(","dict",")",":","A","batch","of","data","from","the","dataloader",".","data_samples","(","Sequence","[","dict","]",")",":","A","batch","of","data","samples","that","contain","annotations","and","predictions","."]
code: def process(
      self, data_batch: dict, data_samples: Sequence[dict]
  ) -> None:
      """Process one batch of data samples and predictions. The processed
      results should be stored in ``self.results``, which will be used to
      compute the metrics when all batches have been processed.
  
      Args:
          data_batch (dict): A batch of data from the dataloader.
          data_samples (Sequence[dict]): A batch of data samples that
              contain annotations and predictions.
      """
      for data_sample in data_samples:
          gt = copy.deepcopy(data_sample)
          # TODO: Need to refactor to support LoadAnnotations
          gt_instances = gt["gt_instances"]
          gt_ignore_instances = gt["ignored_instances"]
          ann = dict(
              labels=gt_instances["labels"].cpu().numpy(),
              bboxes=gt_instances["bboxes"].cpu().numpy(),
              bboxes_ignore=gt_ignore_instances["bboxes"].cpu().numpy(),
              labels_ignore=gt_ignore_instances["labels"].cpu().numpy(),
          )
  
          pred = data_sample["pred_instances"]
          pred_bboxes = pred["bboxes"].cpu().numpy()
          pred_scores = pred["scores"].cpu().numpy()
          pred_labels = pred["labels"].cpu().numpy()
  
          dets = []
          for label in range(len(self.dataset_meta["classes"])):
              index = np.where(pred_labels == label)[0]
              pred_bbox_scores = np.hstack(
                  [
                      pred_bboxes[index],
                      pred_scores[index].reshape((-1, 1)),
                  ]
              )
              dets.append(pred_bbox_scores)
  
          self.results.append((ann, dets))
  
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 2 for calling the VOCMetric obj's underlying member method code with example usage: obj.process(data_batch, data_samples) without return types