code: def _compute_stats_single_threshold(
      tp: np.ndarray,
      fp: np.ndarray,
      dt_scores_sorted: np.ndarray,
      recall_thresholds: np.ndarray | Sequence[float],
      num_gt: int,
  ) -> tuple[float, np.ndarray, np.ndarray]:
      """
      Compute recall value, precision curve and scores thresholds
      Adapted from https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py
  
      Args:
          tp (np.ndarray): cumsum over true positives [R], R is the number of detections
          fp (np.ndarray): cumsum over false positives [R], R is the number of detections
          dt_scores_sorted (np.ndarray): sorted (descending) scores [R], R is the number of detections
          recall_thresholds (Sequence[float]): recall thresholds which should be evaluated
          num_gt (int): number of ground truth bounding boxes (excluding boxes which are ignored)
  
      Returns:
          - float, overall recall for given IoU value
          - np.ndarray, precision values at defined recall values
            [RTH], where RTH is the number of recall thresholds
          - np.ndarray, prediction scores corresponding to recall values
            [RTH], where RTH is the number of recall thresholds
      """
      num_recall_th = len(recall_thresholds)
  
      rc = tp / num_gt
      # np.spacing(1) is the smallest representable epsilon with float
      pr = tp / (fp + tp + np.spacing(1))
  
      if len(tp):
          recall = rc[-1]
      else:
          # no prediction
          recall = 0
  
      # array where precision values nearest to given recall th are saved
      precision = np.zeros((num_recall_th,))
      # save scores for corresponding recall value in here
      th_scores = np.zeros((num_recall_th,))
      # numpy is slow without cython optimization for accessing elements
      # use python array gets significant speed improvement
      pr = pr.tolist()
      precision = precision.tolist()
  
      # smooth precision curve (create box shape)
      for i in range(len(tp) - 1, 0, -1):
          if pr[i] > pr[i - 1]:
              pr[i - 1] = pr[i]
  
      # get indices to nearest given recall threshold (nn interpolation!)
      inds = np.searchsorted(rc, recall_thresholds, side="left")
      try:
          for save_idx, array_index in enumerate(inds):
              precision[save_idx] = pr[array_index]
              th_scores[save_idx] = dt_scores_sorted[array_index]
      except BaseException:
          pass
  
      return recall, np.array(precision), np.array(th_scores)
  
file_path: MONAI/monai/apps/detection/metrics/coco.py
imports: from __future__ import annotations
  import logging
  import time
  from collections.abc import Sequence
  from typing import Any
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _compute_stats_single_threshold(tp, fp, dt_scores_sorted, recall_thresholds, num_gt) and returns: recall,  np,  np