code: def _evaluate_detections(
      classIndex,
      all_boxes,
      gtInfos,
      overlapThreshold=0.5,
      use_07_metric=False,
  ):
      """
      Top level function that does the PASCAL VOC evaluation.
      """
  
      # parse detections for this class
      # shape of all_boxes: e.g. 21 classes x 4952 images x 58 rois x 5 coords+score
      num_images = len(all_boxes[0])
      detBboxes = []
      detImgIndices = []
      detConfidences = []
      for imgIndex in range(num_images):
          dets = all_boxes[classIndex][imgIndex]
          if dets != []:
              for k in range(dets.shape[0]):
                  detImgIndices.append(imgIndex)
                  detConfidences.append(dets[k, -1])
                  # the VOCdevkit expects 1-based indices
                  detBboxes.append(
                      [
                          dets[k, 0] + 1,
                          dets[k, 1] + 1,
                          dets[k, 2] + 1,
                          dets[k, 3] + 1,
                      ]
                  )
      detBboxes = np.array(detBboxes)
      detConfidences = np.array(detConfidences)
  
      # compute precision / recall / ap
      rec, prec, ap = _voc_computePrecisionRecallAp(
          class_recs=gtInfos,
          confidence=detConfidences,
          image_ids=detImgIndices,
          BB=detBboxes,
          ovthresh=overlapThreshold,
          use_07_metric=use_07_metric,
      )
      return rec, prec, ap
  
imports: import numpy
  from utils.nms_wrapper import apply_nms_to_test_set_results
label_desc: Use image node_id 2 for calling a global function with example usage: _evaluate_detections(classIndex, all_boxes, gtInfos, overlapThreshold, use_07_metric) and returns: rec,  prec,  ap