Skip to content

Commit

Permalink
fix segmentation map order
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Davidyuk <igor.davidyuk@intel.com>
  • Loading branch information
igor-davidyuk committed May 29, 2024
1 parent 0b950cf commit 3bd00bc
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def convert_saliency_map(
:return: Prediction object with corresponding label
"""
saliency_map = inference_results.saliency_map
if not saliency_map:
if len(saliency_map) == 0:
return None
saliency_map = cv2.resize(
np.transpose(saliency_map.squeeze(0), (1, 2, 0)),
Expand Down Expand Up @@ -236,7 +236,7 @@ def convert_saliency_map(
:return: Prediction object with corresponding label
"""
saliency_map = inference_results.saliency_map
if not saliency_map:
if len(saliency_map) == 0:
return None
saliency_map = cv2.resize(
np.transpose(saliency_map.squeeze(0), (1, 2, 0)),
Expand Down Expand Up @@ -458,10 +458,10 @@ def convert_saliency_map(
:return: Prediction object with corresponding label
"""
saliency_map = inference_results.saliency_map
if not saliency_map:
if len(saliency_map) == 0:
return None
saliency_map = np.transpose(saliency_map, (2, 0, 1)) # shape: (N classes, h, w)
return {label.name: saliency_map[i] for i, label in enumerate(self.labels)}
return {label.name: saliency_map[i + 1] for i, label in enumerate(self.labels)}


class AnomalyToPredictionConverter(InferenceResultsToPredictionConverter):
Expand Down

0 comments on commit 3bd00bc

Please sign in to comment.