Skip to content

Commit

Permalink
update type and docstring of spro_score function
Browse files Browse the repository at this point in the history
Signed-off-by: Willy Fitra Hendria <[email protected]>
  • Loading branch information
willyfh committed Feb 10, 2024
1 parent e8e7360 commit ccef95c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/anomalib/metrics/spro.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ def compute(self) -> torch.Tensor:

def spro_score(
predictions: torch.Tensor,
targets: torch.Tensor,
targets: list[torch.Tensor],
threshold: float = 0.5,
saturation_config: dict | None = None,
) -> torch.Tensor:
"""Calculate the SPRO score for a batch of predictions.
Args:
predictions (torch.Tensor): Predicted anomaly masks.
targets: (torch.Tensor): Ground truth anomaly masks with non-binary values and, original height and width
targets: (list[torch.Tensor]): Ground truth anomaly masks with original height and width. Each element in the
list is a tensor list of masks for the corresponding image.
threshold (float): When predictions are passed as float, the threshold is used to binarize the predictions.
saturation_config (dict): Saturations configuration for each label (pixel value) as the keys.
Defaults: ``None`` (which the score is equivalent to PRO metric, but with the 'region' are
Expand Down

0 comments on commit ccef95c

Please sign in to comment.