openvinotoolkit / openvino_notebooks

📚 Jupyter notebook tutorials for OpenVINO™
Apache License 2.0
2.3k stars 791 forks source link

Add third saliency map interpretation notebook #2240

Closed GalyaZalesskaya closed 1 month ago

GalyaZalesskaya commented 1 month ago

The third part of showing Explainable AI toolkit functionality. First part: https://github.com/openvinotoolkit/openvino_notebooks/pull/2150 Second part: https://github.com/openvinotoolkit/openvino_notebooks/pull/2159

review-notebook-app[bot] commented 1 month ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

review-notebook-app[bot] commented 1 month ago

View / edit / reply to this conversation on ReviewNB

negvet commented on 2024-07-29T16:26:08Z ----------------------------------------------------------------

This notebook shows which saliency map are generated in different scenarios, in case of correct and confident prediction, in case of low-confident prediction and in case of mixed up classes.

What about below:

This notebook shows how to use saliency maps to evaluate and debug model reasoning.

For example, it might be important to make sure that the model is using relevant features (pixels) to make a correct prediction (e.g. it might be desirable that the model is not relying on X class features to predict Y class). On the other side, it is valuable to observe which features are used when the model is wrong.

Below, we present examples of saliency map analysis for the following cases: correct and highly-confident prediction, correct and low-confident prediction, wrong prediction.


review-notebook-app[bot] commented 1 month ago

View / edit / reply to this conversation on ReviewNB

negvet commented on 2024-07-30T11:48:26Z ----------------------------------------------------------------

Line #1.    # Download 330 MB of 320 px ImageNet subset with dogs breeds

dog breeds


review-notebook-app[bot] commented 1 month ago

View / edit / reply to this conversation on ReviewNB

negvet commented on 2024-07-30T11:48:27Z ----------------------------------------------------------------

Line #2.    img_data_formats = (".jpg", ".jpeg", ".JPEG", ".gif", ".bmp", ".tif", ".tiff", ".png")

Do we need all of those formats? if possible, let's simplify it to make notebook more concise.


review-notebook-app[bot] commented 1 month ago

View / edit / reply to this conversation on ReviewNB

negvet commented on 2024-07-30T11:48:27Z ----------------------------------------------------------------

The model is from timm, right? then, let's be a bit more specific about its origin:

In this notebook, for demonstration purposes, we'll use an already converted to IR model "mobilenetv3_large_100.ra_in1k", from timm (PyTorch Image Models).


review-notebook-app[bot] commented 1 month ago

View / edit / reply to this conversation on ReviewNB

negvet commented on 2024-07-30T11:48:28Z ----------------------------------------------------------------

Line #2.        # Implementing own pre-process function based on model's implementation

let's make it a docstring


review-notebook-app[bot] commented 1 month ago

View / edit / reply to this conversation on ReviewNB

negvet commented on 2024-07-30T11:48:29Z ----------------------------------------------------------------

Line #5.        # Normalization and scaling for timm model

Normalization, specific for timm model


review-notebook-app[bot] commented 1 month ago

View / edit / reply to this conversation on ReviewNB

negvet commented on 2024-07-30T11:48:29Z ----------------------------------------------------------------

Line #19.        # Process model prediction

also a docstring


review-notebook-app[bot] commented 1 month ago

View / edit / reply to this conversation on ReviewNB

negvet commented on 2024-07-30T11:48:30Z ----------------------------------------------------------------

Line #20.        prediction_processed = softmax(x)

return softmax(x)

should it be "return softmax(x)[0]" to remove the batch dimension?


review-notebook-app[bot] commented 1 month ago

View / edit / reply to this conversation on ReviewNB

negvet commented on 2024-07-30T11:48:31Z ----------------------------------------------------------------

let's clean this cell output


GalyaZalesskaya commented on 2024-07-30T13:23:13Z ----------------------------------------------------------------

This is the logger.info output that for some reason can't be captured by usual "%%capture" magic function. The other way to clean output is to add setLevel for logger, but it will require additional logger import, making the overall decision not concise. Maybe we can leave it as it is.