code: def print_map_summary(
      mean_ap, results, dataset=None, scale_ranges=None, logger=None
  ):
      """Print mAP and results of each class.
  
      A table will be printed to show the gts/dets/recall/AP of each class and
      the mAP.
  
      Args:
          mean_ap (float): Calculated from `eval_map()`.
          results (list[dict]): Calculated from `eval_map()`.
          dataset (list[str] | str | None): Dataset name or dataset classes.
          scale_ranges (list[tuple] | None): Range of scales to be evaluated.
          logger (logging.Logger | str | None): The way to print the mAP
              summary. See `mmdet.utils.print_log()` for details. Default: None.
      """
  
      if logger == "silent":
          return
  
      if isinstance(results[0]["ap"], np.ndarray):
          num_scales = len(results[0]["ap"])
      else:
          num_scales = 1
  
      if scale_ranges is not None:
          assert len(scale_ranges) == num_scales
  
      num_classes = len(results)
  
      recalls = np.zeros((num_scales, num_classes), dtype=np.float32)
      aps = np.zeros((num_scales, num_classes), dtype=np.float32)
      num_gts = np.zeros((num_scales, num_classes), dtype=int)
      for i, cls_result in enumerate(results):
          if cls_result["recall"].size > 0:
              recalls[:, i] = np.array(cls_result["recall"], ndmin=2)[
                  :, -1
              ]
          aps[:, i] = cls_result["ap"]
          num_gts[:, i] = cls_result["num_gts"]
  
      if dataset is None:
          label_names = [str(i) for i in range(num_classes)]
      elif mmcv.is_str(dataset):
          label_names = get_classes(dataset)
      else:
          label_names = dataset
  
      if not isinstance(mean_ap, list):
          mean_ap = [mean_ap]
  
      header = ["class", "gts", "dets", "recall", "ap"]
      for i in range(num_scales):
          if scale_ranges is not None:
              print_log(f"Scale range {scale_ranges[i]}", logger=logger)
          table_data = [header]
          for j in range(num_classes):
              row_data = [
                  label_names[j],
                  num_gts[i, j],
                  results[j]["num_dets"],
                  f"{recalls[i, j]:.3f}",
                  f"{aps[i, j]:.3f}",
              ]
              table_data.append(row_data)
          table_data.append(["mAP", "", "", "", f"{mean_ap[i]:.3f}"])
          table = AsciiTable(table_data)
          table.inner_footing_row_border = True
          print_log("\n" + table.table, logger=logger)
  
file_path: insightface/detection/scrfd/mmdet/core/evaluation/mean_ap.py
imports: from multiprocessing import Pool
  import mmcv
  import numpy
  from mmcv.utils import print_log
  from terminaltables import AsciiTable
  from .bbox_overlaps import bbox_overlaps
  from .class_names import get_classes
label_desc: Use image node_id 6 for calling a global function with example usage: print_map_summary(mean_ap, results, dataset, scale_ranges, logger) without return types