class_docstr: Per-Region Overlap (PRO) Score.
class_docstr_tok: ["Per-Region","Overlap","(","PRO",")","Score","."]
docstr: Compute the macro average of the PRO score across all regions in all batches.
docstr_tok: ["Compute","the","macro","average","of","the","PRO","score","across","all","regions","in","all","batches","."]
code: def compute(self) -> Tensor:
      """Compute the macro average of the PRO score across all regions in all batches."""
      target = dim_zero_cat(self.target)
      preds = dim_zero_cat(self.preds)
  
      target = target.unsqueeze(1).type(
          torch.float
      )  # kornia expects N1HW and FloatTensor format
      if target.is_cuda:
          comps = connected_components_gpu(target)
      else:
          comps = connected_components_cpu(target)
      pro = pro_score(preds, comps, threshold=self.threshold)
      return pro
  
file_path: anomalib/src/anomalib/utils/metrics/pro.py
imports: from __future__ import annotations
  import torch
  from torch import Tensor
  from torchmetrics import Metric
  from torchmetrics.functional import recall
  from torchmetrics.utilities.data import dim_zero_cat
  from anomalib.utils.cv import connected_components_cpu, connected_components_gpu
label_desc: Use image node_id 3 for calling the PRO obj's underlying member method code with example usage: obj.compute() and returns: pro