code: def compute_pro(anomaly_maps, ground_truth_maps, num_thresholds):
      """
      Compute the PRO curve at equidistant interpolation points for a set of anomaly maps with corresponding ground
      truth maps. The number of interpolation points can be set manually.
  
      Args:
          anomaly_maps: List of anomaly maps (2D numpy arrays) that contain a real-valued anomaly score at each pixel.
          ground_truth_maps: List of ground truth maps (2D numpy arrays) that contain binary-valued ground truth labels
              for each pixel. 0 indicates that a pixel is anomaly-free. 1 indicates that a pixel contains an anomaly.
          num_thresholds: Number of thresholds to compute the PRO curve.
  
      Returns:
          fprs: List of false positive rates.
          pros: List of correspoding PRO values.
      """
      # Fetch sorted anomaly scores.
      (
          ground_truth_components,
          anomaly_scores_ok_pixels,
      ) = collect_anomaly_scores(anomaly_maps, ground_truth_maps)
      # Select equidistant thresholds.
      threshold_positions = np.linspace(
          0,
          len(anomaly_scores_ok_pixels) - 1,
          num=num_thresholds,
          dtype=int,
      )
  
      fprs = [1.0]
      pros = [1.0]
      for pos in threshold_positions:
          threshold = anomaly_scores_ok_pixels[pos]
  
          # Compute the false positive rate for this threshold.
          fpr = 1.0 - (pos + 1) / len(anomaly_scores_ok_pixels)
  
          # Compute the PRO value for this threshold.
          pro = 0.0
          for component in ground_truth_components:
              pro += component.compute_overlap(threshold)
          pro /= len(ground_truth_components)
  
          fprs.append(fpr)
          pros.append(pro)
  
      # Return (FPR/PRO) pairs in increasing FPR order.
      fprs = fprs[::-1]
      pros = pros[::-1]
  
      return fprs, pros
  
file_path: anomalib/tests/helpers/aupro_reference.py
imports: from bisect import bisect
  import numpy
  from scipy.ndimage.measurements import label
label_desc: Use image node_id 3 for calling a global function with example usage: compute_pro(anomaly_maps, ground_truth_maps, num_thresholds) and returns: fprs,  pros