code: def computeAveragePrecision(recalls, precisions, use_07_metric=False):
      """
      Computes VOC AP given precision and recall.
      """
      if use_07_metric:
          # 11 point metric
          ap = 0.0
          for t in np.arange(0.0, 1.1, 0.1):
              if np.sum(recalls >= t) == 0:
                  p = 0
              else:
                  p = np.max(precisions[recalls >= t])
              ap = ap + p / 11.0
      else:
          # correct AP calculation
          # first append sentinel values at the end
          mrecalls = np.concatenate(([0.0], recalls, [1.0]))
          mprecisions = np.concatenate(([0.0], precisions, [0.0]))
  
          # compute the precision envelope
          for i in range(mprecisions.size - 1, 0, -1):
              mprecisions[i - 1] = np.maximum(
                  mprecisions[i - 1], mprecisions[i]
              )
  
          # to calculate area under PR curve, look for points
          # where X axis (recall) changes value
          i = np.where(mrecalls[1:] != mrecalls[:-1])[0]
  
          # and sum (\Delta recall) * prec
          ap = np.sum(
              (mrecalls[i + 1] - mrecalls[i]) * mprecisions[i + 1]
          )
      return ap
  
imports: import numpy
  from utils.nms_wrapper import apply_nms_to_test_set_results
label_desc: Use image node_id 3 for calling a global function with example usage: computeAveragePrecision(recalls, precisions, use_07_metric) and returns: ap