Can a heatmap generation techniques such as layer-wise relevance propagation or Grad-CAM be implemented using OpenVINO™?
Heatmaps can be used to visualize the decision-making process of neural networks.
In order to generate heatmaps in OpenVINO™, it is necessary to:
Access the output feature maps of the target convolutional layer and the corresponding weights.
| Note | This can be done through the model.add_outputs() function call when initializing the network in OpenVINO™ 2.0+ API (replaces the deprecated CNNNetwork: addOutput()). |
After running the inference, calculate the weighted sum of the weights with the feature maps to generate the Class Activation Map.
For Grad-CAM implementation, compute gradients of the target class with respect to the feature maps, then multiply the gradients by the feature maps.
Apply ReLU activation to remove negative values and normalize the resulting heatmap.
Resize the heatmap to match the input image dimensions and overlay it on the original image for visualization.
Additional steps: