Skip to content

Instantly share code, notes, and snippets.

@dipanjanS
Created August 15, 2019 11:03
Show Gist options
  • Save dipanjanS/46a8bdab1ffe2f5768e6555e65a823f4 to your computer and use it in GitHub Desktop.
Save dipanjanS/46a8bdab1ffe2f5768e6555e65a823f4 to your computer and use it in GitHub Desktop.
from tf_explain.core.smoothgrad import SmoothGrad
explainer = SmoothGrad()
grid1 = explainer.explain(([img], None), model, 281, 80, .2)
grid2 = explainer.explain(([img], None), model, 285, 80, .2)
fig = plt.figure(figsize = (18, 8))
ax1 = fig.add_subplot(1, 3, 1)
ax1.imshow(img_inp / 255.)
ax1.imshow(grid1, alpha=0.9, cmap='binary_r')
ax2 = fig.add_subplot(1, 3, 2)
ax2.imshow(img_inp / 255.)
ax2.imshow(grid2, alpha=0.9, cmap='binary_r')
ax3 = fig.add_subplot(1, 3, 3)
ax3.imshow(img_inp / 255.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment