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: Display or save image with groung truths and predictions from a
  model.
  
  Args:
      dataset (Dataset): A PyTorch dataset.
      results (list): Object detection or panoptic segmentation
          results from test results pkl file.
      performances (dict): A dict contains samples's indices
          in dataset and model's performance on them.
      out_dir (str, optional): The filename to write the image.
          Defaults: None.
      task (str): The task to be performed. Defaults: 'det'
docstr_tok: ["Display","or","save","image","with","groung","truths","and","predictions","from","a","model",".","Args",":","dataset","(","Dataset",")",":","A","PyTorch","dataset",".","results","(","list",")",":","Object","detection","or","panoptic","segmentation","results","from","test","results","pkl","file",".","performances","(","dict",")",":","A","dict","contains","samples","'s","indices","in","dataset","and","model","'s","performance","on","them",".","out_dir","(","str",",","optional",")",":","The","filename","to","write","the","image",".","Defaults",":","None",".","task","(","str",")",":","The","task","to","be","performed",".","Defaults",":","'det","'"]
code: def _save_image_gts_results(
      self, dataset, results, performances, out_dir=None, task="det"
  ):
      """Display or save image with groung truths and predictions from a
      model.
  
      Args:
          dataset (Dataset): A PyTorch dataset.
          results (list): Object detection or panoptic segmentation
              results from test results pkl file.
          performances (dict): A dict contains samples's indices
              in dataset and model's performance on them.
          out_dir (str, optional): The filename to write the image.
              Defaults: None.
          task (str): The task to be performed. Defaults: 'det'
      """
      mkdir_or_exist(out_dir)
  
      for performance_info in performances:
          index, performance = performance_info
          data_info = dataset[index]
          data_info["gt_instances"] = data_info["instances"]
  
          # calc save file path
          filename = data_info["img_path"]
          fname, name = osp.splitext(osp.basename(filename))
          save_filename = (
              fname + "_" + str(round(performance, 3)) + name
          )
          out_file = osp.join(out_dir, save_filename)
  
          if task == "det":
              gt_instances = InstanceData()
              gt_instances.bboxes = [
                  d["bbox"] for d in data_info["gt_instances"]
              ]
              gt_instances.labels = [
                  d["bbox_label"] for d in data_info["gt_instances"]
              ]
  
              pred_instances = InstanceData()
              pred_instances.bboxes = results[index]["pred_instances"][
                  "bboxes"
              ]
              pred_instances.labels = results[index]["pred_instances"][
                  "labels"
              ]
              pred_instances.scores = results[index]["pred_instances"][
                  "scores"
              ]
  
              data_samples = DetDataSample()
              data_samples.pred_instances = pred_instances
              data_samples.gt_instances = gt_instances
  
          elif task == "seg":
              gt_panoptic_seg = PixelData()
              gt_panoptic_seg.sem_seg = [
                  d["gt_seg_map"] for d in data_info["gt_instances"]
              ]
  
              pred_panoptic_seg = PixelData()
              pred_panoptic_seg.sem_seg = results[index][
                  "pred_panoptic_seg"
              ]["sem_seg"]
  
              data_samples = DetDataSample()
              data_samples.pred_panoptic_seg = pred_panoptic_seg
              data_samples.gt_panoptic_seg = gt_panoptic_seg
  
          img = mmcv.imread(filename, channel_order="rgb")
          self.visualizer.add_datasample(
              "image",
              img,
              data_samples,
              show=self.show,
              draw_gt=False,
              pred_score_thr=self.score_thr,
              out_file=out_file,
          )
  
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 2 for calling the ResultVisualizer obj's underlying member method code with example usage: obj._save_image_gts_results(dataset, results, performances, out_dir, task) without return types