# Class Activation Map Guided Backpropagation for Discriminative Explanations
## 3 Methods
### Proposed Method  
Building on the analysis from the previous section, we identify the limitations of relying solely on importance scores above a threshold to identify significant features, as less significant features might also exhibit high importance scores. We observed that significant features at specific spatial locations tend to have high importance scores, leading to a substantial total sum. Conversely, less significant features, even though they may include some high scores, usually have a lower total sum. With these insights, we introduce a novel method known as Class activation map Guided Back Propagation (CGBP). CGBP begins by using gradient backpropagation to compute the gradients of the last convolutional layer's feature maps for the category being explained. During this process, CGBP calculates class activation maps (CAMs) for both the target and hostile phases. Thresholds are applied to the CAMs to create spatial masks and importance scores to create feature masks. Gradients that meet the criteria of both masks are selected and processed using RectGrad to generate the corresponding saliency maps. These phases are depicted in Figure 2. Finally, CGBP compares the attribution scores of the target and hostile saliency maps at corresponding positions, combining them to produce the final saliency map, as depicted in Figure 3.  
We initiated the backpropagation of gradients from the softmax output of the target category to the feature maps of the last convolutional layer. Let \(A\) and \(R\) represent the feature maps and gradients of the last convolutional layer, respectively, with dimensions  
Figure 1: Visualization of saliency maps and gradients generated by the RectGrad method for detailed analysis. (**a**) Original input image showing a zebra and an African elephant. (**b**) Saliency maps for the categories of zebra (left) and African elephant (right) generated by RectGrad. (**c**) Visualization of gradients from the last ReLU layer of the feature modules of VGG16. of \(K\times H\times W\). Here, \(A_{k,i,j}\) and \(R_{k,i,j}\) denote the values at the spatial position \((i,j)\) for the \(k\)-th channel. To identify significant features, we weight the feature maps (\(A\)) by the gradients (\(R\)) to obtain their importance scores:  
\[\hat{A}_{k,i,j}=A_{k,i,j}\cdot R_{k,i,j} \tag{1}\]  
We obtain two class activation maps, denoted as \(P\) and \(N\). Here, \(P\) represents the sum of positive importance scores supporting the prediction at each spatial location, while \(N\) represents the sum of absolute negative scores rejecting the prediction. As features supporting the prediction tend to have positive values of \(\hat{A}\) and rejecting features tend to have negative values, \(P\) and \(N\) are defined as follows:  
\[P_{i,j}=\sum_{k}^{K}\hat{A}_{k,i,j}\cdot\mathbb{I}(\hat{A}_{k,i,j}>0) \tag{2}\]  
\[N_{i,j}=\sum_{k}^{K}|\hat{A}_{k,i,j}|\cdot\mathbb{I}(\hat{A}_{k,i,j}<0) \tag{3}\]  
Next, we compute the modified class activation map \(\bar{P}\) and \(\bar{N}\), highlighting regions where supporting and rejecting features are predominant:  
\[\bar{P}_{i,j}=\mathbb{I}(P_{i,j}>N_{i,j})\cdot P_{i,j} \tag{4}\]  
Figure 3: CGBP produces the final saliency map by comparing the target and hostile saliency maps and masking attribution scores that are lower in the hostile saliency map. Figure 2: CGBP uses gradient backpropagation to calculate feature importance scores and generates a target (hostile) class activation map. Threshold-based spatial and feature masking are applied, followed by RectGrad, to produce the target (hostile) saliency map. \[\bar{N}_{i,j}=\mathbb{I}(P_{i,j}<N_{i,j})\cdot N_{i,j} \tag{5}\]  
To identify significant target and hostile features, we define the criteria as follows: target features should exceed a threshold \(\theta^{+}\) in the modified class activation map \(\bar{P}\), while hostile features should be less than a threshold \(\theta^{-}\) in the modified class activation map \(\bar{N}\).