class_docstr: Instance segmentation metric for COCO bbox and segm task.
  Will return box summary, box metric, seg summary and seg metric.
  
  Parameters
  ----------
  dataset : instance of gluoncv.data.COCOInstance
      The validation dataset.
  save_prefix : str
      Prefix for the saved JSON results.
  use_time : bool
      Append unique datetime string to created JSON file name if ``True``.
  cleanup : bool
      Remove created JSON file if ``True``. When cleanup is True, we do not output json to save
      computation.
  use_ext : bool
      Whether to use external module built by NVIDIA, which is significantly faster.
      Make sure NVIDIA MSCOCO API is installed!
  starting_id : int, default is 0
      If using distributed evaluation, it need to be set to the start of each shard.
  score_thresh : float
      Detection results with confident scores smaller than ``score_thresh`` will
      be discarded before saving to results.
class_docstr_tok: ["Instance","segmentation","metric","for","COCO","bbox","and","segm","task",".","Will","return","box","summary",",","box","metric",",","seg","summary","and","seg","metric",".","Parameters","--","--","--","--","--","dataset",":","instance","of","gluoncv.data.COCOInstance","The","validation","dataset",".","save_prefix",":","str","Prefix","for","the","saved","JSON","results",".","use_time",":","bool","Append","unique","datetime","string","to","created","JSON","file","name","if","``","True","``",".","cleanup",":","bool","Remove","created","JSON","file","if","``","True","``",".","When","cleanup","is","True",",","we","do","not","output","json","to","save","computation",".","use_ext",":","bool","Whether","to","use","external","module","built","by","NVIDIA",",","which","is","significantly","faster",".","Make","sure","NVIDIA","MSCOCO","API","is","installed","!","starting_id",":","int",",","default","is","0","If","using","distributed","evaluation",",","it","need","to","be","set","to","the","start","of","each","shard",".","score_thresh",":","float","Detection","results","with","confident","scores","smaller","than","``","score_thresh","``","will","be","discarded","before","saving","to","results","."]
docstr: Return the default AP from coco_eval.
docstr_tok: ["Return","the","default","AP","from","coco_eval","."]
code: def _get_ap(self, coco_eval):
      """Return the default AP from coco_eval."""
  
      # Metric printing adapted from detectron/json_dataset_evaluator.
      def _get_thr_ind(coco_eval, thr):
          ind = np.where(
              (coco_eval.params.iouThrs > thr - 1e-5)
              & (coco_eval.params.iouThrs < thr + 1e-5)
          )[0][0]
          iou_thr = coco_eval.params.iouThrs[ind]
          assert np.isclose(iou_thr, thr)
          return ind
  
      IoU_lo_thresh = 0.5
      IoU_hi_thresh = 0.95
      ind_lo = _get_thr_ind(coco_eval, IoU_lo_thresh)
      ind_hi = _get_thr_ind(coco_eval, IoU_hi_thresh)
      # precision has dims (iou, recall, cls, area range, max dets)
      # area range index 0: all area ranges
      # max dets index 2: 100 per image
      precision = coco_eval.eval["precision"][
          ind_lo : (ind_hi + 1), :, :, 0, 2
      ]
      ap_default = np.mean(precision[precision > -1])
      return ap_default
  
file_path: gluon-cv/gluoncv/utils/metrics/coco_instance.py
imports: from __future__ import absolute_import
  import io
  import sys
  import warnings
  from os import path
  import numpy
  import mxnet
label_desc: Use image node_id 5 for calling the COCOInstanceMetric obj's underlying member method code with example usage: obj._get_ap(coco_eval) and returns: ap_default, ind