code: def evaluate_detections(
      all_boxes,
      all_gt_infos,
      classes,
      use_gpu_nms,
      device_id,
      apply_mms=True,
      nms_threshold=0.5,
      conf_threshold=0.0,
      use_07_metric=False,
  ):
      """
      Computes per-class average precision.
  
      Args:
          all_boxes:          shape of all_boxes: e.g. 21 classes x 4952 images x 58 rois x 5 coords+score
          all_gt_infos:       a dictionary that contains all ground truth annoations in the following form:
                              {'class_A': [{'bbox': array([[ 376.,  210.,  456.,  288.,   10.]], dtype=float32), 'det': [False], 'difficult': [False]}, ... ]}
                              'class_B': [ <bbox_list> ], <more_class_to_bbox_list_entries> }
          classes:            a list of class name, e.g. ['__background__', 'avocado', 'orange', 'butter']
          use_07_metric:      whether to use VOC07's 11 point AP computation (default False)
          apply_mms:          whether to apply non maximum suppression before computing average precision values
          nms_threshold:      the threshold for discarding overlapping ROIs in nms
          conf_threshold:     a minimum value for the score of an ROI. ROIs with lower score will be discarded
  
      Returns:
          aps - average precision value per class in a dictionary {classname: ap}
      """
  
      if apply_mms:
          print(
              "Number of rois before non-maximum suppression: %d"
              % sum(
                  [
                      len(all_boxes[i][j])
                      for i in range(len(all_boxes))
                      for j in range(len(all_boxes[0]))
                  ]
              )
          )
          nms_dets, _ = apply_nms_to_test_set_results(
              all_boxes,
              nms_threshold,
              conf_threshold,
              use_gpu_nms,
              device_id,
          )
          print(
              "Number of rois  after non-maximum suppression: %d"
              % sum(
                  [
                      len(nms_dets[i][j])
                      for i in range(len(all_boxes))
                      for j in range(len(all_boxes[0]))
                  ]
              )
          )
      else:
          print("Skipping non-maximum suppression")
          nms_dets = all_boxes
  
      aps = {}
      for classIndex, className in enumerate(classes):
          if className != "__background__":
              rec, prec, ap = _evaluate_detections(
                  classIndex,
                  nms_dets,
                  all_gt_infos[className],
                  use_07_metric=use_07_metric,
              )
              aps[className] = ap
  
      return aps
  
imports: import numpy
  from utils.nms_wrapper import apply_nms_to_test_set_results
label_desc: Use image node_id 1 for calling a global function with example usage: evaluate_detections(all_boxes, all_gt_infos, classes, use_gpu_nms, device_id, apply_mms, nms_threshold, conf_threshold, use_07_metric) and returns: aps