Skip to content

Commit

Permalink
make AUPIMOResult.num_thresholds optional
Browse files Browse the repository at this point in the history
Signed-off-by: jpcbertoldo <24547377+jpcbertoldo@users.noreply.github.com>
  • Loading branch information
jpcbertoldo committed Oct 8, 2024
1 parent 2e8e0fe commit 3868fbe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/anomalib/metrics/pimo/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class AUPIMOResult:
# metadata
fpr_lower_bound: float
fpr_upper_bound: float
num_thresholds: int
num_thresholds: int | None

# data
thresh_lower_bound: float = field(repr=False)
Expand Down Expand Up @@ -169,7 +169,8 @@ def __post_init__(self) -> None:
try:
_validate.is_rate_range((self.fpr_lower_bound, self.fpr_upper_bound))
# TODO(jpcbertoldo): warn when it's too low (use parameters from the numpy code) # noqa: TD003
_validate.is_num_thresholds_gte2(self.num_thresholds)
if self.num_thresholds is not None:
_validate.is_num_thresholds_gte2(self.num_thresholds)
_validate.is_rates(self.aupimos, nan_allowed=True) # validate is_aupimos

_validate.validate_threshold_bounds((self.thresh_lower_bound, self.thresh_upper_bound))
Expand All @@ -194,7 +195,6 @@ def from_pimo_result(
num_thresholds_auc: number of thresholds used to effectively compute AUPIMO;
NOT the number of thresholds used to compute the PIMO curve!
aupimos: AUPIMO scores
paths: paths to the source images to which the AUPIMO scores correspond.
"""
if pimo_result.per_image_tprs.shape[0] != aupimos.shape[0]:
msg = (
Expand Down

0 comments on commit 3868fbe

Please sign in to comment.