Skip to content

Commit

Permalink
Remove incorrect standardization method
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Wawrzyński <adam.wawrzynski@reasonfieldlab.com>
  • Loading branch information
Adam Wawrzyński committed Dec 28, 2022
1 parent 6cdba18 commit cfa709a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
5 changes: 0 additions & 5 deletions autoxai/explainer/base_explainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import torch
from captum.attr import visualization as viz

from autoxai.explainer.model_utils import standardize_matrix


class CVExplainer(ABC):
"""Abstract explainer class."""
Expand Down Expand Up @@ -82,9 +80,6 @@ def visualize(
if len(transformed_img.shape) >= 3:
transformed_img_np = np.transpose(transformed_img_np, (1, 2, 0))

attributions_np = standardize_matrix(matrix=attributions_np)
transformed_img_np = standardize_matrix(matrix=transformed_img_np)

figure, _ = viz.visualize_image_attr_multiple(
attr=attributions_np,
original_image=transformed_img_np,
Expand Down
13 changes: 0 additions & 13 deletions autoxai/explainer/model_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""File contains functions to modifiy DNN models."""

import numpy as np
import torch


Expand All @@ -21,15 +20,3 @@ def modify_modules(model: torch.nn.Module) -> torch.nn.Module:
module.inplace = False

return model


def standardize_matrix(matrix: np.ndarray) -> np.ndarray:
"""Standardize matrix to range [0-1].
Args:
matrix: Any matrix.
Returns:
Standardize matrix.
"""
return (matrix - np.min(matrix)) / np.max(matrix)

0 comments on commit cfa709a

Please sign in to comment.