docstr: Compute and display summary metrics for evaluation results.
  Note this functin can *only* be applied on the default parameter setting
docstr_tok: ["Compute","and","display","summary","metrics","for","evaluation","results",".","Note","this","functin","can","*","only","*","be","applied","on","the","default","parameter","setting"]
code: def summarize(self):
      """
      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} {} @[ {}={:<9} | area={:>6s} | maxDets={:>3d} ] = {:0.3f}"
          titleStr = (
              "Average Precision" if ap == 1 else "Average Recall"
          )
          typeStr = "(AP)" if ap == 1 else "(AR)"
          measure = "IoU"
          if self.params.iouType == "keypoints":
              measure = "OKS"
          elif self.params.iouType == "uv":
              measure = "OGPS"
          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(np.abs(iouThr - p.iouThrs) < 0.001)[0]
                  s = s[t]
              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]
              s = s[:, :, aind, mind]
          if len(s[s > -1]) == 0:
              mean_s = -1
          else:
              mean_s = np.mean(s[s > -1])
          print(
              iStr.format(
                  titleStr,
                  typeStr,
                  measure,
                  iouStr,
                  areaRng,
                  maxDets,
                  mean_s,
              )
          )
          return mean_s
  
      def _summarizeDets():
          stats = np.zeros((12,))
          stats[0] = _summarize(1)
          stats[1] = _summarize(
              1, iouThr=0.5, maxDets=self.params.maxDets[2]
          )
          stats[2] = _summarize(
              1, iouThr=0.75, maxDets=self.params.maxDets[2]
          )
          stats[3] = _summarize(
              1, areaRng="small", maxDets=self.params.maxDets[2]
          )
          stats[4] = _summarize(
              1, areaRng="medium", maxDets=self.params.maxDets[2]
          )
          stats[5] = _summarize(
              1, areaRng="large", maxDets=self.params.maxDets[2]
          )
          stats[6] = _summarize(0, maxDets=self.params.maxDets[0])
          stats[7] = _summarize(0, maxDets=self.params.maxDets[1])
          stats[8] = _summarize(0, maxDets=self.params.maxDets[2])
          stats[9] = _summarize(
              0, areaRng="small", maxDets=self.params.maxDets[2]
          )
          stats[10] = _summarize(
              0, areaRng="medium", maxDets=self.params.maxDets[2]
          )
          stats[11] = _summarize(
              0, areaRng="large", maxDets=self.params.maxDets[2]
          )
          return stats
  
      def _summarizeKps():
          stats = np.zeros((10,))
          stats[0] = _summarize(1, maxDets=20)
          stats[1] = _summarize(1, maxDets=20, iouThr=0.5)
          stats[2] = _summarize(1, maxDets=20, iouThr=0.75)
          stats[3] = _summarize(1, maxDets=20, areaRng="medium")
          stats[4] = _summarize(1, maxDets=20, areaRng="large")
          stats[5] = _summarize(0, maxDets=20)
          stats[6] = _summarize(0, maxDets=20, iouThr=0.5)
          stats[7] = _summarize(0, maxDets=20, iouThr=0.75)
          stats[8] = _summarize(0, maxDets=20, areaRng="medium")
          stats[9] = _summarize(0, maxDets=20, areaRng="large")
          return stats
  
      def _summarizeUvs():
          stats = np.zeros((18,))
          stats[0] = _summarize(1, maxDets=self.params.maxDets[0])
          stats[1] = _summarize(
              1, maxDets=self.params.maxDets[0], iouThr=0.5
          )
          stats[2] = _summarize(
              1, maxDets=self.params.maxDets[0], iouThr=0.55
          )
          stats[3] = _summarize(
              1, maxDets=self.params.maxDets[0], iouThr=0.60
          )
          stats[4] = _summarize(
              1, maxDets=self.params.maxDets[0], iouThr=0.65
          )
          stats[5] = _summarize(
              1, maxDets=self.params.maxDets[0], iouThr=0.70
          )
          stats[6] = _summarize(
              1, maxDets=self.params.maxDets[0], iouThr=0.75
          )
          stats[7] = _summarize(
              1, maxDets=self.params.maxDets[0], iouThr=0.80
          )
          stats[8] = _summarize(
              1, maxDets=self.params.maxDets[0], iouThr=0.85
          )
          stats[9] = _summarize(
              1, maxDets=self.params.maxDets[0], iouThr=0.90
          )
          stats[10] = _summarize(
              1, maxDets=self.params.maxDets[0], iouThr=0.95
          )
          stats[11] = _summarize(
              1, maxDets=self.params.maxDets[0], areaRng="medium"
          )
          stats[12] = _summarize(
              1, maxDets=self.params.maxDets[0], areaRng="large"
          )
          stats[13] = _summarize(0, maxDets=self.params.maxDets[0])
          stats[14] = _summarize(
              0, maxDets=self.params.maxDets[0], iouThr=0.5
          )
          stats[15] = _summarize(
              0, maxDets=self.params.maxDets[0], iouThr=0.75
          )
          stats[16] = _summarize(
              0, maxDets=self.params.maxDets[0], areaRng="medium"
          )
          stats[17] = _summarize(
              0, maxDets=self.params.maxDets[0], areaRng="large"
          )
          return stats
  
      if not self.eval:
          raise Exception("Please run accumulate() first")
      iouType = self.params.iouType
      if iouType in ["segm", "bbox"]:
          summarize = _summarizeDets
      elif iouType in ["keypoints"]:
          summarize = _summarizeKps
      elif iouType in ["uv"]:
          summarize = _summarizeUvs
      self.stats = summarize()
  
imports: import numpy
  import datetime
  import time
  from collections import defaultdict
  from pycocotools import mask
  import copy
  import h5py
  import pickle
  from scipy.io import loadmat
  import scipy.spatial.distance
  import os
  import itertools
  from scipy.optimize import linear_sum_assignment
  import numpy.ma
  import cv2
label_desc: Use image node_id 14 for calling the denseposeCOCOeval obj's underlying member method code with example usage: obj.summarize() and returns: mean_s, stats, stats, stats