Message Boards Message Boards

Generate class activation maps for neural networks?

Posted 7 years ago

What is the easier way to generate class activation maps (CAM) to a resnet or VGG-16 neural network?

From the Wolfram Neural Net Repository the main function of the implementation of the resnet50 [[1]] is done using:

resnet50 = NetChain[Join[
       <|"conv1" -> 
         ConvolutionLayer[64, 7, "Stride" -> 2, "PaddingSize" -> 3],
        "bn_conv1" -> 
         BatchNormalizationLayer["Momentum" -> 0.9, "Epsilon" -> 0.0001],
        "conv1_relu" -> ElementwiseLayer[Ramp],
        "pool1_pad" -> 
         PaddingLayer[{{0, 0}, {0, 1}, {0, 1}}, "Padding" -> "Fixed"],
        "pool1" -> PoolingLayer[3, "Stride" -> 2]
        |>,
       blockChain[{"2a", "2b", "2c"}, 256, 1],
       blockChain[{"3a", "3b", "3c", "3d"}, 512, 2],
       blockChain[{"4a", "4b", "4c", "4d", "4e", "4f"}, 1024, 2],
       blockChain[{"5a", "5b", "5c"}, 2048, 2],
       <|"pool5" -> PoolingLayer[7, "Function" -> Mean],
        "flatten_0" -> FlattenLayer[],
        "fc1000" -> LinearLayer[2],
        "prob" -> SoftmaxLayer[]|>
       ]
      , "Input" -> 
       NetEncoder[{"Image", 224, "MeanImage" -> resnetMeanImage}],
      "Output" -> NetDecoder[{"Class", {"Pathological", "Healthy"}}]
      ]
POSTED BY: Luis Mendes
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract