Skip to content

Commit

Permalink
Added Occlusion demo to README
Browse files Browse the repository at this point in the history
- updated use of --relevance-norm
  • Loading branch information
chr5tphr committed Jun 23, 2021
1 parent c2c5c88 commit 62cfa83
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,15 @@ $ .venv/bin/python feed_forward.py \
--parameters params/vgg16-397923af.pth \
--model vgg16 \
--composite epsilon_gamma_box \
--relevance-norm symmetric \
--cmap coldnhot
```
which computes the lrp heatmaps according to the `epsilon_gamma_box` rule and stores them in `results`, along with the respective input images.

The resulting heatmaps may look like the following:
![beacon heatmaps](https://raw.githubusercontent.com/chr5tphr/zennit/master/share/img/beacon_vgg16_epsilon_gamma_box.png)

Alternatively, heatmaps with absolute relevances for SmoothGrad may be computed by omitting `--composite` and supplying `--attributor`:
Alternatively, heatmaps for SmoothGrad with absolute relevances may be computed by omitting `--composite` and supplying `--attributor`:
```shell
$ .venv/bin/python feed_forward.py \
data/lighthouses \
Expand All @@ -101,7 +102,21 @@ $ .venv/bin/python feed_forward.py \
--parameters params/vgg16-397923af.pth \
--model vgg16 \
--attributor smoothgrad \
--absolute-relevance \
--relevance-norm absolute \
--cmap hot
```
For Integrated Gradients, `--attributor integrads` may be provided.

Heatmaps for Occlusion Analysis with unaligned relevances may be computed by executing:
```shell
$ .venv/bin/python feed_forward.py \
data/lighthouses \
'results/vgg16_smoothgrad_{sample:02d}.png' \
--inputs 'results/vgg16_input_{sample:02d}.png' \
--parameters params/vgg16-397923af.pth \
--model vgg16 \
--attributor occlusion \
--relevance-norm unaligned \
--cmap hot
```

Expand Down

0 comments on commit 62cfa83

Please sign in to comment.