Skip to content

Commit

Permalink
➕Add reset methods to metrics (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwinvaidya17 committed Aug 11, 2022
1 parent 32ebbc3 commit a0e040d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions anomalib/utils/metrics/adaptive_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ def compute(self) -> torch.Tensor:
else:
self.value = thresholds[torch.argmax(f1_score)]
return self.value

def reset(self) -> None:
"""Reset the metric."""
self.precision_recall_curve.reset()
4 changes: 4 additions & 0 deletions anomalib/utils/metrics/optimal_f1.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ def compute(self) -> torch.Tensor:
self.threshold = thresholds[torch.argmax(f1_score)]
optimal_f1_score = torch.max(f1_score)
return optimal_f1_score

def reset(self) -> None:
"""Reset the metric."""
self.precision_recall_curve.reset()

0 comments on commit a0e040d

Please sign in to comment.