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

Fix bugs #69

Merged
merged 14 commits into from
Sep 17, 2024
Merged
Prev Previous commit
Next Next commit
fix bhwc
negvet committed Sep 12, 2024
commit 742cbed112b32629183aee6a4571429f1b79b787
1 change: 1 addition & 0 deletions openvino_xai/explainer/explainer.py
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ class ExplainMode(Enum):
Contains the following values:
WHITEBOX - The model is explained in white box mode, i.e. XAI branch is getting inserted into the model graph.
BLACKBOX - The model is explained in black box model.
AUTO - The model is explained in the white-box mode first, if fails - black-box mode will run.
"""

WHITEBOX = "whitebox"
4 changes: 3 additions & 1 deletion openvino_xai/methods/black_box/aise/base.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
import openvino.runtime as ov
from scipy.optimize import direct

from openvino_xai.common.utils import IdentityPreprocessFN
from openvino_xai.common.utils import IdentityPreprocessFN, is_bhwc_layout
from openvino_xai.methods.black_box.base import BlackBoxXAIMethod


@@ -92,6 +92,8 @@ def _objective_function(self, args) -> float:

kernel_mask = self._mask_generator.generate_kernel_mask(kernel_params)
kernel_mask = np.clip(kernel_mask, 0, 1)
if is_bhwc_layout(self.data_preprocessed):
kernel_mask = np.expand_dims(kernel_mask, 2)

pred_loss_preserve = 0.0
if self.preservation: