Skip to content

Instantly share code, notes, and snippets.

@dipanjanS
Created August 15, 2019 10:20
Show Gist options
  • Save dipanjanS/f7fed0794dd0f465181a5fb8a74502a5 to your computer and use it in GitHub Desktop.
Save dipanjanS/f7fed0794dd0f465181a5fb8a74502a5 to your computer and use it in GitHub Desktop.
# get label imagenet ID
imgnet_map['Egyptian_cat']
from tf_explain.core.occlusion_sensitivity import OcclusionSensitivity
explainer = OcclusionSensitivity()
img_inp = tf.keras.preprocessing.image.load_img(IMAGE_PATH, target_size=(299, 299))
img_inp = tf.keras.preprocessing.image.img_to_array(img_inp)
grid = explainer.explain(([img_inp], None), model, 285, 7)
fig, ax = plt.subplots(figsize=(8, 8))
plt.imshow(grid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment