class_docstr: Display and save evaluation results.
  
  Args:
      show (bool): Whether to show the image. Default: True.
      wait_time (float): Value of waitKey param. Default: 0.
      score_thr (float): Minimum score of bboxes to be shown.
         Default: 0.
      runner (:obj:`Runner`): The runner of the visualization process.
class_docstr_tok: ["Display","and","save","evaluation","results",".","Args",":","show","(","bool",")",":","Whether","to","show","the","image",".","Default",":","True",".","wait_time","(","float",")",":","Value","of","waitKey","param",".","Default",":","0.","score_thr","(","float",")",":","Minimum","score","of","bboxes","to","be","shown",".","Default",":","0.","runner","(",":","obj",":","`","Runner","`",")",":","The","runner","of","the","visualization","process","."]
docstr: Evaluation for object detection.
  
  Args:
      dataset (Dataset): A PyTorch dataset.
      results (list): Object detection results from test
          results pkl file.
      topk (int): Number of the highest topk and
          lowest topk after evaluation index sorting. Default: 20.
      eval_fn (callable, optional): Eval function, Default: None.
  
  Returns:
      tuple: A tuple contains good samples and bad samples.
          good_mAPs (dict[int, float]): A dict contains good
              samples's indices in dataset and model's
              performance on them.
          bad_mAPs (dict[int, float]): A dict contains bad
              samples's indices in dataset and model's
              performance on them.
docstr_tok: ["Evaluation","for","object","detection",".","Args",":","dataset","(","Dataset",")",":","A","PyTorch","dataset",".","results","(","list",")",":","Object","detection","results","from","test","results","pkl","file",".","topk","(","int",")",":","Number","of","the","highest","topk","and","lowest","topk","after","evaluation","index","sorting",".","Default",":","20.","eval_fn","(","callable",",","optional",")",":","Eval","function",",","Default",":","None",".","Returns",":","tuple",":","A","tuple","contains","good","samples","and","bad","samples",".","good_mAPs","(","dict","[","int",",","float","]",")",":","A","dict","contains","good","samples","'s","indices","in","dataset","and","model's","performance","on","them",".","bad_mAPs","(","dict","[","int",",","float","]",")",":","A","dict","contains","bad","samples","'s","indices","in","dataset","and","model's","performance","on","them","."]
code: def detection_evaluate(self, dataset, results, topk=20, eval_fn=None):
      """Evaluation for object detection.
  
      Args:
          dataset (Dataset): A PyTorch dataset.
          results (list): Object detection results from test
              results pkl file.
          topk (int): Number of the highest topk and
              lowest topk after evaluation index sorting. Default: 20.
          eval_fn (callable, optional): Eval function, Default: None.
  
      Returns:
          tuple: A tuple contains good samples and bad samples.
              good_mAPs (dict[int, float]): A dict contains good
                  samples's indices in dataset and model's
                  performance on them.
              bad_mAPs (dict[int, float]): A dict contains bad
                  samples's indices in dataset and model's
                  performance on them.
      """
  
      if eval_fn is None:
          eval_fn = bbox_map_eval
      else:
          assert callable(eval_fn)
  
      prog_bar = ProgressBar(len(results))
      _mAPs = {}
      data_info = {}
      for i, (result,) in enumerate(zip(results)):
          # self.dataset[i] should not call directly
          # because there is a risk of mismatch
          data_info = dataset.prepare_data(i)
          data_info["bboxes"] = data_info["gt_bboxes"].tensor
          data_info["labels"] = data_info["gt_bboxes_labels"]
  
          pred = result["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(dataset.metainfo["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)
          mAP = eval_fn(dets, data_info)
  
          _mAPs[i] = mAP
          prog_bar.update()
      # descending select topk image
      _mAPs = list(sorted(_mAPs.items(), key=lambda kv: kv[1]))
      good_mAPs = _mAPs[-topk:]
      bad_mAPs = _mAPs[:topk]
  
      return good_mAPs, bad_mAPs
  
imports: import argparse
  import os.path
  from multiprocessing import Pool
  import mmcv
  import numpy
  from mmengine.config import Config, DictAction
  from mmengine.fileio import load
  from mmengine.registry import init_default_scope
  from mmengine.runner import Runner
  from mmengine.structures import InstanceData, PixelData
  from mmengine.utils import ProgressBar, check_file_exist, mkdir_or_exist
  from mmdet.datasets import get_loading_pipeline
  from mmdet.evaluation import eval_map
  from mmdet.registry import DATASETS, RUNNERS
  from mmdet.structures import DetDataSample
  from mmdet.utils import replace_cfg_vals, update_data_root
  from mmdet.visualization import DetLocalVisualizer
label_desc: Use image node_id 4 for calling the ResultVisualizer obj's underlying member method code with example usage: obj.detection_evaluate(dataset, results, topk, eval_fn) and returns: good_mAPs,  bad_mAPs