Skip to content

Commit

Permalink
Merge pull request #1 from samet-akcay/fix/pr-1872
Browse files Browse the repository at this point in the history
Fix pre-commit errors
  • Loading branch information
TurboJonte authored Mar 22, 2024
2 parents 1b056bb + dcc585d commit ba9226b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/anomalib/deploy/inferencers/openvino_inferencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from PIL import Image

from anomalib import TaskType
from anomalib.data.utils.label import LabelName
from anomalib.utils.visualization import ImageResult

from .base_inferencer import Inferencer
Expand Down Expand Up @@ -231,7 +232,7 @@ def post_process(self, predictions: np.ndarray, metadata: dict | DictConfig | No

# Initialize the result variables.
anomaly_map: np.ndarray | None = None
pred_label: float | None = None
pred_label: LabelName | None = None
pred_mask: float | None = None

# If predictions returns a single value, this means that the task is
Expand All @@ -247,10 +248,9 @@ def post_process(self, predictions: np.ndarray, metadata: dict | DictConfig | No
# Common practice in anomaly detection is to assign anomalous
# label to the prediction if the prediction score is greater
# than the image threshold.
pred_label: str | None = None
if "image_threshold" in metadata:
pred_idx = pred_score >= metadata["image_threshold"]
pred_label = "Anomalous" if pred_idx else "Normal"
pred_label = LabelName.ABNORMAL if pred_idx else LabelName.NORMAL

if task == TaskType.CLASSIFICATION:
_, pred_score = self._normalize(pred_scores=pred_score, metadata=metadata)
Expand Down

0 comments on commit ba9226b

Please sign in to comment.