Skip to content

Commit

Permalink
update class activation mapping visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
transcranial committed Jan 5, 2018
1 parent 82ec022 commit d6684b6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/visualizations/CAM.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,16 @@ export default class CAM {
// traverse until we get feature map weights
// in Inception-V3, for example, this is the kernel weights of the final fully-connected layer
// in Squeezenet, for example, this is simply the output of the GlobalAveragePooling2D layer
let weightsFound = false
let finalLayerReached = false
let traversingLayer = this.poolLayer
while (!weightsFound && !finalLayerReached) {
if (!traversingLayer.outbound.length) {
this.weights = this.poolLayer.output
}
while (traversingLayer.outbound.length) {
traversingLayer = this.modelLayersMap.get(traversingLayer.outbound[0])
if (traversingLayer.weights['kernel']) {
this.weights = traversingLayer.weights['kernel']
weightsFound = true
} else if (!traversingLayer.outbound.length) {
} else {
this.weights = this.poolLayer.output
finalLayerReached = true
}
}

Expand Down

0 comments on commit d6684b6

Please sign in to comment.