From 2aede4a4c699a1bf3acbb6f7e00c8a1f15e31c56 Mon Sep 17 00:00:00 2001 From: Dick Ameln Date: Wed, 22 Jan 2025 18:32:26 +0100 Subject: [PATCH] use right threshold in forward pass --- src/anomalib/post_processing/one_class.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/anomalib/post_processing/one_class.py b/src/anomalib/post_processing/one_class.py index bc7b504bac..b227d5abb6 100644 --- a/src/anomalib/post_processing/one_class.py +++ b/src/anomalib/post_processing/one_class.py @@ -181,8 +181,8 @@ def forward(self, predictions: InferenceBatch) -> InferenceBatch: msg = "At least one of pred_score or anomaly_map must be provided." raise ValueError(msg) pred_score = predictions.pred_score or torch.amax(predictions.anomaly_map, dim=(-2, -1)) - pred_score = self._normalize(pred_score, self.image_min, self.image_max, self._image_threshold) - anomaly_map = self._normalize(predictions.anomaly_map, self.pixel_min, self.pixel_max, self._pixel_threshold) + pred_score = self._normalize(pred_score, self.image_min, self.image_max, self.image_threshold) + anomaly_map = self._normalize(predictions.anomaly_map, self.pixel_min, self.pixel_max, self.pixel_threshold) pred_label = self._apply_threshold(pred_score, self.normalized_image_threshold) pred_mask = self._apply_threshold(anomaly_map, self.normalized_pixel_threshold) return InferenceBatch(