Skip to content

missing documentation for OcclusionSensitivity (not callback) #190

@clstaudt

Description

@clstaudt

https://tf-explain.readthedocs.io/en/latest/api/tf_explain.core.html#tf-explain-core-occlusion-sensitivity-module

... seems to be empty.

In addition to the API docs, a minimal example like this would be helpful:

from pathlib import Path
from tensorflow import keras
from tf_explain.core.occlusion_sensitivity import OcclusionSensitivity

# Load pretrained model
model = keras.applications.vgg16.VGG16(weights="imagenet", include_top=True)

# Load a sample image
IMAGE_PATH = Path("/path/to/your/image.jpg")
img = keras.preprocessing.image.load_img(IMAGE_PATH, target_size=(224, 224))
img = keras.preprocessing.image.img_to_array(img)
data = ([img], None)

# Create an instance of OcclusionSensitivity
explainer = OcclusionSensitivity()

# Generate the occlusion sensitivity grid
grid = explainer.explain(data, model, class_index=281, patch_size=10)

# Save the occlusion sensitivity grid
explainer.save(grid, ".", "occlusion_sensitivity.png")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions