@@ -31,7 +31,8 @@ model = VGG(16, pretrain=true).layers
3131model = strip_softmax (flatten_chain (model))
3232
3333# Load input
34- img = load (" castle.jpg" )
34+ url = " https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle.jpg"
35+ img = load (url)
3536input = preprocess_imagenet (img)
3637input = reshape (input, 224 , 224 , 3 , :) # reshape to WHCN format
3738
@@ -53,14 +54,18 @@ heatmap(input, analyzer, 920) # for heatmap
5354```
5455Heatmaps for all implemented analyzers are shown in the following table. Red color indicate regions of positive relevance towards the selected class, whereas regions in blue are of negative relevance.
5556
56- | ** Analyzer** | ** Heatmap for class "castle"** | ** Heatmap for class "street sign"** |
57- | :---------------------------------------- | :------------------------------:| :----------------------------------:|
58- | ` LRP ` composite using ` EpsilonGammaBox ` | ![ ] [ castle-lrp-comp ] | ![ ] [ streetsign-lrp-comp ] |
59- | ` LRP ` | ![ ] [ castle-lrp ] | ![ ] [ streetsign-lrp ] |
60- | ` InputTimesGradient ` | ![ ] [ castle-ixg ] | ![ ] [ streetsign-ixg ] |
61- | ` Gradient ` | ![ ] [ castle-grad ] | ![ ] [ streetsign-grad ] |
62- | ` SmoothGrad ` | ![ ] [ castle-smoothgrad ] | ![ ] [ streetsign-smoothgrad ] |
63- | ` IntegratedGradients ` | ![ ] [ castle-intgrad ] | ![ ] [ streetsign-intgrad ] |
57+ | ** Analyzer** | ** Heatmap for class "castle"** | ** Heatmap for class "street sign"** |
58+ | :--------------------------------------------- | :------------------------------:| :----------------------------------:|
59+ | ` LRP ` with ` EpsilonPlus ` composite | ![ ] [ castle-comp-ep ] | ![ ] [ streetsign-comp-ep ] |
60+ | ` LRP ` with ` EpsilonPlusFlat ` composite | ![ ] [ castle-comp-epf ] | ![ ] [ streetsign-comp-epf ] |
61+ | ` LRP ` with ` EpsilonAlpha2Beta1 ` composite | ![ ] [ castle-comp-eab ] | ![ ] [ streetsign-comp-eab ] |
62+ | ` LRP ` with ` EpsilonAlpha2Beta1Flat ` composite | ![ ] [ castle-comp-eabf ] | ![ ] [ streetsign-comp-eabf ] |
63+ | ` LRP ` with ` EpsilonGammaBox ` composite | ![ ] [ castle-comp-egb ] | ![ ] [ streetsign-comp-egb ] |
64+ | ` LRP ` | ![ ] [ castle-lrp ] | ![ ] [ streetsign-lrp ] |
65+ | ` InputTimesGradient ` | ![ ] [ castle-ixg ] | ![ ] [ streetsign-ixg ] |
66+ | ` Gradient ` | ![ ] [ castle-grad ] | ![ ] [ streetsign-grad ] |
67+ | ` SmoothGrad ` | ![ ] [ castle-smoothgrad ] | ![ ] [ streetsign-smoothgrad ] |
68+ | ` IntegratedGradients ` | ![ ] [ castle-intgrad ] | ![ ] [ streetsign-intgrad ] |
6469
6570The code used to generate these heatmaps can be found [ here] [ asset-code ] .
6671
@@ -91,8 +96,8 @@ Currently, the following analyzers are implemented:
9196 └── Composite
9297 ├── EpsilonGammaBox
9398 ├── EpsilonPlus
94- ├── EpsilonAlpha2Beta1
9599 ├── EpsilonPlusFlat
100+ ├── EpsilonAlpha2Beta1
96101 └── EpsilonAlpha2Beta1Flat
97102
98103```
@@ -116,18 +121,28 @@ Contributions are welcome!
116121
117122[ asset-code ] : https://github.com/adrhill/ExplainableAI.jl/blob/gh-pages/assets/heatmaps/generate_assets.jl
118123[ castle ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle.jpg
124+
119125[ castle-lrp ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_LRP.png
120- [ castle-lrp-comp ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_LRPEpsilonGammaBox.png
121126[ castle-ixg ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_InputTimesGradient.png
122127[ castle-grad ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_Gradient.png
123128[ castle-smoothgrad ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_SmoothGrad.png
124129[ castle-intgrad ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_IntegratedGradients.png
130+ [ castle-comp-egb ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_LRPEpsilonGammaBox.png
131+ [ castle-comp-ep ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_LRPEpsilonPlus.png
132+ [ castle-comp-epf ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_LRPEpsilonPlusFlat.png
133+ [ castle-comp-eab ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_LRPEpsilonAlpha2Beta1.png
134+ [ castle-comp-eabf ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_LRPEpsilonAlpha2Beta1Flat.png
135+
125136[ streetsign-lrp ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_LRP.png
126- [ streetsign-lrp-comp ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_LRPEpsilonGammaBox.png
127137[ streetsign-ixg ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_InputTimesGradient.png
128138[ streetsign-grad ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_Gradient.png
129139[ streetsign-smoothgrad ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_SmoothGrad.png
130140[ streetsign-intgrad ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_IntegratedGradients.png
141+ [ streetsign-comp-egb ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_LRPEpsilonGammaBox.png
142+ [ streetsign-comp-ep ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_LRPEpsilonPlus.png
143+ [ streetsign-comp-epf ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_LRPEpsilonPlusFlat.png
144+ [ streetsign-comp-eab ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_LRPEpsilonAlpha2Beta1.png
145+ [ streetsign-comp-eabf ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_LRPEpsilonAlpha2Beta1Flat.png
131146
132147[ docs-stab-img ] : https://img.shields.io/badge/docs-stable-blue.svg
133148[ docs-stab-url ] : https://adrhill.github.io/ExplainableAI.jl/stable
0 commit comments