code: def summarize(self, catId=None):
      """
      Compute and display summary metrics for evaluation results.
      Note this functin can *only* be applied on the default parameter setting
      """
  
      def _summarize(ap=1, iouThr=None, areaRng="all", maxDets=100):
          p = self.params
          iStr = " {:<18} {} @[ IoU={:<9} | area={:>6s} | maxDets={:>3d} ] = {:0.3f}"
          titleStr = (
              "Average Precision" if ap == 1 else "Average Recall"
          )
          typeStr = "(AP)" if ap == 1 else "(AR)"
          iouStr = (
              "{:0.2f}:{:0.2f}".format(p.iouThrs[0], p.iouThrs[-1])
              if iouThr is None
              else "{:0.2f}".format(iouThr)
          )
  
          aind = [
              i
              for i, aRng in enumerate(p.areaRngLbl)
              if aRng == areaRng
          ]
          mind = [
              i for i, mDet in enumerate(p.maxDets) if mDet == maxDets
          ]
  
          if ap == 1:
              # dimension of precision: [TxRxKxAxM]
              s = self.eval["precision"]
              # IoU
              if iouThr is not None:
                  t = np.where(iouThr == p.iouThrs)[0]
                  s = s[t]
  
              if isinstance(catId, int):
                  s = s[:, :, catId, aind, mind]
              else:
                  s = s[:, :, :, aind, mind]
  
          else:
              # dimension of recall: [TxKxAxM]
              s = self.eval["recall"]
              if iouThr is not None:
                  t = np.where(iouThr == p.iouThrs)[0]
                  s = s[t]
  
              if isinstance(catId, int):
                  s = s[:, catId, aind, mind]
              else:
                  s = s[:, :, aind, mind]
  
          if len(s[s > -1]) == 0:
              mean_s = -1
          else:
              mean_s = np.mean(s[s > -1])
  
          print_string = iStr.format(
              titleStr, typeStr, iouStr, areaRng, maxDets, mean_s
          )
          return mean_s, print_string
  
      stats, print_list = [0] * 12, [""] * 12
      stats[0], print_list[0] = _summarize(1)
      stats[1], print_list[1] = _summarize(
          1, iouThr=0.5, maxDets=self.params.maxDets[2]
      )
      stats[2], print_list[2] = _summarize(
          1, iouThr=0.75, maxDets=self.params.maxDets[2]
      )
      stats[3], print_list[3] = _summarize(
          1, areaRng="small", maxDets=self.params.maxDets[2]
      )
      stats[4], print_list[4] = _summarize(
          1, areaRng="medium", maxDets=self.params.maxDets[2]
      )
      stats[5], print_list[5] = _summarize(
          1, areaRng="large", maxDets=self.params.maxDets[2]
      )
      stats[6], print_list[6] = _summarize(
          0, maxDets=self.params.maxDets[0]
      )
      stats[7], print_list[7] = _summarize(
          0, maxDets=self.params.maxDets[1]
      )
      stats[8], print_list[8] = _summarize(
          0, maxDets=self.params.maxDets[2]
      )
      stats[9], print_list[9] = _summarize(
          0, areaRng="small", maxDets=self.params.maxDets[2]
      )
      stats[10], print_list[10] = _summarize(
          0, areaRng="medium", maxDets=self.params.maxDets[2]
      )
      stats[11], print_list[11] = _summarize(
          0, areaRng="large", maxDets=self.params.maxDets[2]
      )
  
      print_info = "\n".join(print_list)
  
      if not self.eval:
          raise Exception("Please run accumulate() first")
  
      return stats, print_info
  
file_path: deep-learning-for-image-processing/pytorch_object_detection/faster_rcnn/validation.py
imports: import os
  import json
  import torch
  from tqdm import tqdm
  import numpy
  import transforms
  from network_files import FasterRCNN
  from backbone import resnet50_fpn_backbone
  from my_dataset import VOCDataSet
  from train_utils import get_coco_api_from_dataset, CocoEvaluator
label_desc: Use image node_id 1 for calling a global function with example usage: summarize(catId) and returns: stats,  print_info, mean_s,  print_string