class_docstr: Custom dataset for detection.
  
  The annotation format is shown as follows. The `ann` field is optional for
  testing.
  
  .. code-block:: none
  
      [
          {
              'filename': 'a.jpg',
              'width': 1280,
              'height': 720,
              'ann': {
                  'bboxes': <np.ndarray> (n, 4) in (x1, y1, x2, y2) order.
                  'labels': <np.ndarray> (n, ),
                  'bboxes_ignore': <np.ndarray> (k, 4), (optional field)
                  'labels_ignore': <np.ndarray> (k, 4) (optional field)
              }
          },
          ...
      ]
  
  Args:
      ann_file (str): Annotation file path.
      pipeline (list[dict]): Processing pipeline.
      classes (str | Sequence[str], optional): Specify classes to load.
          If is None, ``cls.CLASSES`` will be used. Default: None.
      data_root (str, optional): Data root for ``ann_file``,
          ``img_prefix``, ``seg_prefix``, ``proposal_file`` if specified.
      test_mode (bool, optional): If set True, annotation will not be loaded.
      filter_empty_gt (bool, optional): If set true, images without bounding
          boxes of the dataset's classes will be filtered out. This option
          only works when `test_mode=False`, i.e., we never filter images
          during tests.
class_docstr_tok: ["Custom","dataset","for","detection",".","The","annotation","format","is","shown","as","follows",".","The","`","ann","`","field","is","optional","for","testing",".","..","code-block",":",":","none","[","{","'filename","'",":","'","a.jpg","'",",","'width","'",":","1280",",","'height","'",":","720",",","'ann","'",":","{","'bboxes","'",":","<","np.ndarray",">","(","n",",","4",")","in","(","x1",",","y1",",","x2",",","y2",")","order",".","'labels","'",":","<","np.ndarray",">","(","n",",",")",",","'bboxes_ignore","'",":","<","np.ndarray",">","(","k",",","4",")",",","(","optional","field",")","'labels_ignore","'",":","<","np.ndarray",">","(","k",",","4",")","(","optional","field",")","}","}",",","...","]","Args",":","ann_file","(","str",")",":","Annotation","file","path",".","pipeline","(","list","[","dict","]",")",":","Processing","pipeline",".","classes","(","str","|","Sequence","[","str","]",",","optional",")",":","Specify","classes","to","load",".","If","is","None",",","``","cls.CLASSES","``","will","be","used",".","Default",":","None",".","data_root","(","str",",","optional",")",":","Data","root","for","``","ann_file","``",",","``","img_prefix","``",",","``","seg_prefix","``",",","``","proposal_file","``","if","specified",".","test_mode","(","bool",",","optional",")",":","If","set","True",",","annotation","will","not","be","loaded",".","filter_empty_gt","(","bool",",","optional",")",":","If","set","true",",","images","without","bounding","boxes","of","the","dataset","'s","classes","will","be","filtered","out",".","This","option","only","works","when","`","test_mode=False","`",",","i.e.",",","we","never","filter","images","during","tests","."]
docstr: Evaluate the dataset.
  
  Args:
      results (list): Testing results of the dataset.
      metric (str | list[str]): Metrics to be evaluated.
      logger (logging.Logger | None | str): Logger used for printing
          related information during evaluation. Default: None.
      proposal_nums (Sequence[int]): Proposal number used for evaluating
          recalls, such as recall@100, recall@1000.
          Default: (100, 300, 1000).
      iou_thr (float | list[float]): IoU threshold. It must be a float
          when evaluating mAP, and can be a list when evaluating recall.
          Default: 0.5.
      scale_ranges (list[tuple] | None): Scale ranges for evaluating mAP.
          Default: None.
docstr_tok: ["Evaluate","the","dataset",".","Args",":","results","(","list",")",":","Testing","results","of","the","dataset",".","metric","(","str","|","list","[","str","]",")",":","Metrics","to","be","evaluated",".","logger","(","logging.Logger","|","None","|","str",")",":","Logger","used","for","printing","related","information","during","evaluation",".","Default",":","None",".","proposal_nums","(","Sequence","[","int","]",")",":","Proposal","number","used","for","evaluating","recalls",",","such","as","recall","@","100",",","recall","@","1000",".","Default",":","(","100",",","300",",","1000",")",".","iou_thr","(","float","|","list","[","float","]",")",":","IoU","threshold",".","It","must","be","a","float","when","evaluating","mAP",",","and","can","be","a","list","when","evaluating","recall",".","Default",":","0.5.","scale_ranges","(","list","[","tuple","]","|","None",")",":","Scale","ranges","for","evaluating","mAP",".","Default",":","None","."]
code: def evaluate(
      self,
      results,
      metric="mAP",
      logger=None,
      proposal_nums=(100, 300, 1000),
      iou_thr=0.5,
      scale_ranges=None,
  ):
      """Evaluate the dataset.
  
      Args:
          results (list): Testing results of the dataset.
          metric (str | list[str]): Metrics to be evaluated.
          logger (logging.Logger | None | str): Logger used for printing
              related information during evaluation. Default: None.
          proposal_nums (Sequence[int]): Proposal number used for evaluating
              recalls, such as recall@100, recall@1000.
              Default: (100, 300, 1000).
          iou_thr (float | list[float]): IoU threshold. It must be a float
              when evaluating mAP, and can be a list when evaluating recall.
              Default: 0.5.
          scale_ranges (list[tuple] | None): Scale ranges for evaluating mAP.
              Default: None.
      """
  
      if not isinstance(metric, str):
          assert len(metric) == 1
          metric = metric[0]
      allowed_metrics = ["mAP", "recall"]
      if metric not in allowed_metrics:
          raise KeyError(f"metric {metric} is not supported")
      annotations = [self.get_ann_info(i) for i in range(len(self))]
      eval_results = OrderedDict()
      if metric == "mAP":
          assert isinstance(iou_thr, float)
          mean_ap, _ = eval_map(
              results,
              annotations,
              scale_ranges=scale_ranges,
              iou_thr=iou_thr,
              dataset=self.CLASSES,
              logger=logger,
          )
          eval_results["mAP"] = mean_ap
      elif metric == "recall":
          gt_bboxes = [ann["bboxes"] for ann in annotations]
          if isinstance(iou_thr, float):
              iou_thr = [iou_thr]
          recalls = eval_recalls(
              gt_bboxes, results, proposal_nums, iou_thr, logger=logger
          )
          for i, num in enumerate(proposal_nums):
              for j, iou in enumerate(iou_thr):
                  eval_results[f"recall@{num}@{iou}"] = recalls[i, j]
          if recalls.shape[1] > 1:
              ar = recalls.mean(axis=1)
              for i, num in enumerate(proposal_nums):
                  eval_results[f"AR@{num}"] = ar[i]
      return eval_results
  
imports: import os.path
  import warnings
  from collections import OrderedDict
  import mmcv
  import numpy
  from torch.utils.data import Dataset
  from mmdet.core import eval_map, eval_recalls
  from .builder import DATASETS
  from .pipelines import Compose
label_desc: Use image node_id 17 for calling the CustomDataset obj's underlying member method code with example usage: obj.evaluate(results, metric, logger, proposal_nums, iou_thr, scale_ranges) and returns: eval_results