Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reset methods to metrics #488

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions anomalib/utils/metrics/adaptive_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,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 @@ -40,3 +40,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()