Skip to content

karl-schulz/attribution-experiments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Attribution Experiments

Implementation and tests of several attribution methods:

... and maybe some others soon.

Example

import matplotlib.pyplot as plt
from attribution.methods.grad_based import SmoothGrad
from attribution.utils.viz import Heatmap

# the model to be inspected
model = ...  # type: torch.nn.Module

# the image to analyse
img = ...  # type: torch.Tensor

# the target label to derive from, ground truth or any other
target = ...  # type: torch.Tensor

# get heatmap for this input image
method = SmoothGrad(model, std=0.2)
hmap = method.get_map(img=img, target=target)

# visualize the result
fig = plt.figure() # the figure to paint to, may be subfigure
visualizer = Heatmap()
visualizer.show(hmap=hmap, img=img, fig=fig)

Good Example

"sturgeon" attribution methods

Bad Example

"basketball" attribution methods

Information Dropout

On cluttered MNIST information dropout

About

Re-Implementing recent DNN Attribution methods

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published