@@ -31,7 +31,8 @@ model = VGG(16, pretrain=true).layers
31
31
model = strip_softmax (flatten_chain (model))
32
32
33
33
# 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)
35
36
input = preprocess_imagenet (img)
36
37
input = reshape (input, 224 , 224 , 3 , :) # reshape to WHCN format
37
38
@@ -53,14 +54,18 @@ heatmap(input, analyzer, 920) # for heatmap
53
54
```
54
55
Heatmaps 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.
55
56
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 ] |
64
69
65
70
The code used to generate these heatmaps can be found [ here] [ asset-code ] .
66
71
@@ -91,8 +96,8 @@ Currently, the following analyzers are implemented:
91
96
└── Composite
92
97
├── EpsilonGammaBox
93
98
├── EpsilonPlus
94
- ├── EpsilonAlpha2Beta1
95
99
├── EpsilonPlusFlat
100
+ ├── EpsilonAlpha2Beta1
96
101
└── EpsilonAlpha2Beta1Flat
97
102
98
103
```
@@ -116,18 +121,28 @@ Contributions are welcome!
116
121
117
122
[ asset-code ] : https://github.com/adrhill/ExplainableAI.jl/blob/gh-pages/assets/heatmaps/generate_assets.jl
118
123
[ castle ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle.jpg
124
+
119
125
[ 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
121
126
[ castle-ixg ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_InputTimesGradient.png
122
127
[ castle-grad ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_Gradient.png
123
128
[ castle-smoothgrad ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_SmoothGrad.png
124
129
[ 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
+
125
136
[ 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
127
137
[ streetsign-ixg ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_InputTimesGradient.png
128
138
[ streetsign-grad ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_Gradient.png
129
139
[ streetsign-smoothgrad ] : https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_SmoothGrad.png
130
140
[ 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
131
146
132
147
[ docs-stab-img ] : https://img.shields.io/badge/docs-stable-blue.svg
133
148
[ docs-stab-url ] : https://adrhill.github.io/ExplainableAI.jl/stable
0 commit comments