-
Notifications
You must be signed in to change notification settings - Fork 110
Open
Description
... 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")Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels