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

Update OV-XAI #2394

Draft
wants to merge 7 commits into
base: latest
Choose a base branch
from
Draft

Conversation

negvet
Copy link
Contributor

@negvet negvet commented Sep 17, 2024

Align OV-XAI notebook with 1.1.0 release

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:20Z
----------------------------------------------------------------

Line #2.        data=input_image,

we don't want to introduce original_image parameter for simplicity here, right? Can we write below in text something like:

"Overlay is applied over the image in data parameter. If it was preprocessed, overlay will be applied over resized image. To pass the original image to apply overlay pass the original image in original_image. More details in 2nd notebook"


negvet commented on 2024-09-18T13:07:16Z
----------------------------------------------------------------

Right, good point, will update

Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:20Z
----------------------------------------------------------------

Line #5.        overlay=True,  # optional, saliency map overlay over the input image, defaults to False

saliency map overlays over the input image, default to False


Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:22Z
----------------------------------------------------------------

Line #3.        targets=retriever_class_index,  # can be a single target or a container of targets

list of targets


negvet commented on 2024-09-18T13:06:50Z
----------------------------------------------------------------

not only list, tuple or numpy.array also would work here. That is why I use general term - container

Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:23Z
----------------------------------------------------------------

Line #4.        overlay=True,  # Saliency map overlay over the original image, False by default, set to True for better visual inspection

As I see in this notebook, the inline comments start with small letters (not capital). Can you please check the consistency here and further?


negvet commented on 2024-09-18T13:09:11Z
----------------------------------------------------------------

Sure, will fix

Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:23Z
----------------------------------------------------------------

Line #8.    # Visualize generated saliency maps for each target class (.plot() supports plotting multiple saliency maps)


Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:24Z
----------------------------------------------------------------

Line #4.    print(f"Saliency maps were generated for {len(explanation.targets)} classes: ")

Now I can relate to your comment that output cells are too big. Let's just leave a number of classes for which saliency maps were generated.


negvet commented on 2024-09-18T13:14:17Z
----------------------------------------------------------------

Will fix

Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:25Z
----------------------------------------------------------------

Line #13.    explanation.save(output)

What do you think about simplifying it?:

explanation.save(output, "grayscale_")

negvet commented on 2024-09-18T13:23:42Z
----------------------------------------------------------------

I like this idea. Adopted

Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:26Z
----------------------------------------------------------------

Line #7.        target_layer="MobilenetV3/Conv_1/Conv2D",  # Optional, by default insert_xai will try to find target_layer automatically


Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:26Z
----------------------------------------------------------------

Can you fix double spaces between "mode" and "treats" in the first sentence?


Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:27Z
----------------------------------------------------------------

AISE is used as a default black-box method. AISE formulates saliency map generation as a kernel density estimation (KDE) problem, and adaptively samples the input masks using a derivative-free optimizer to maximize the mask saliency score


Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:28Z
----------------------------------------------------------------

Please, leave a link to RISE paper


negvet commented on 2024-09-18T13:25:57Z
----------------------------------------------------------------

there is no link as for now

GalyaZalesskaya commented on 2024-09-20T17:57:34Z
----------------------------------------------------------------

Are we talking about the same RISE paper? [1806.07421] RISE: Randomized Input Sampling for Explanation of Black-box Models (arxiv.org)

negvet commented on 2024-09-23T07:22:29Z
----------------------------------------------------------------

Ah, sure, I misunderstood

Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:29Z
----------------------------------------------------------------

Line #14.        explanation.save(output, f"{Path(image_path).stem}_") # pass prefix name with underscore


Copy link

review-notebook-app bot commented Sep 17, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-17T16:55:30Z
----------------------------------------------------------------

Block from L27-L37 can be removed by our great new explanatio.plot with passing confidence scores.


negvet commented on 2024-09-18T14:21:13Z
----------------------------------------------------------------

Exactly, will use explanation.save()

Copy link
Contributor

@GalyaZalesskaya GalyaZalesskaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the great update :)

Comment on lines 951 to 957
AISE
AISEClassification
AISEDetection
WHITEBOX
BLACKBOX
Netron
KDE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these names be organized alphabetically for the simplicity of adding new words?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, updated

@@ -25,22 +25,25 @@ Example: Saliency map for `flat-coated retriever` class for MobileNetV3 classifi

The tutorial consists of the following steps:

- Run explainer in Auto-mode
- Run explainer in `Auto` mode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In L11-L12 here we talk only about IR models:

[OpenVINO™ Explainable AI (XAI)](https://github.com/openvinotoolkit/openvino_xai/) provides a suite of XAI algorithms for visual explanation of
[OpenVINO™](https://github.com/openvinotoolkit/openvino) Intermediate Representation (IR) models.

But now thanks to Songki, we have an option to insert_xai branch to PyTorch as well , even thought not to create Explainer using it.
What do you think, should we mention PyTorch usecase in readmes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned PyTorch in the insert_xai section

Copy link
Contributor Author

negvet commented Sep 18, 2024

not only list, tuple or numpy.array also would work here. That is why I use general term - container


View entire conversation on ReviewNB

Copy link
Contributor Author

negvet commented Sep 18, 2024

Right, good point, will update


View entire conversation on ReviewNB

Copy link
Contributor Author

negvet commented Sep 18, 2024

Sure, will fix


View entire conversation on ReviewNB

Copy link
Contributor Author

negvet commented Sep 18, 2024

Will fix


View entire conversation on ReviewNB

Copy link
Contributor Author

negvet commented Sep 18, 2024

I like this idea. Adopted


View entire conversation on ReviewNB

Copy link
Contributor Author

negvet commented Sep 18, 2024

there is no link as for now


View entire conversation on ReviewNB

Copy link
Contributor Author

negvet commented Sep 18, 2024

Exactly, will use explanation.save()


View entire conversation on ReviewNB

Copy link
Contributor

Copy link

review-notebook-app bot commented Sep 20, 2024

View / edit / reply to this conversation on ReviewNB

GalyaZalesskaya commented on 2024-09-20T18:03:19Z
----------------------------------------------------------------

        saliency_map_name_prefix = f"{image_name}_{gt_info}_pr_"
        saliency_map_name_postfix = "_"

More details to names can be added (but not necessary)


negvet commented on 2024-09-23T07:27:03Z
----------------------------------------------------------------

Added

Copy link
Contributor Author

negvet commented Sep 23, 2024

Ah, sure, I misunderstood


View entire conversation on ReviewNB

Copy link
Contributor Author

negvet commented Sep 23, 2024

Added


View entire conversation on ReviewNB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants