# Integrating Explanations into CNNs by Adopting Spiking Attention Block for Skin Cancer Detection
## 3 Proposed Methodology
#### CNN Model Setup  
This section provides a comprehensive analysis of the complex structure of all the models. The activation, dropout, flatten, and dense layers are added following the embed ding of the SAB with pretrained models to incorporate regularization. The experiments are conducted using two approaches: (a) training and testing on the HAM10000 dataset and (b) training on the HAM10000 dataset and testing on the ISIC2019 dataset. The experiments were performed using the Keras framework. Three pretrained CNN models, i.e., InceptionResnetV2 [26], DenseNet201 [27], and Xception [28], are used as a backbone model for this work. The architectures of these three selected pretrained CNN models are presented in Figures 5-13, where, for each model, several building blocks are defined; then, a minimized actual version of a pretrained model is presented, and lastly, the proposed architecture of the pretrained model after embedding the SAB module is presented. In Figures 7, 10, and 13, some differences are observed. These changes are intentional and reflect architectural modifications made to improve performance and adapt the network structure to better suit the requirements of the proposed model. As shown in Figure 6, in the original architecture of InceptionResnetV2, IRB8 has \(9\)\(IRB_{6}\) blocks and then \(1\)\(IRB_{1}\) block, which feeds the output to the GAP block. In the proposed InceptionResnetV2 with SAB, the architecture is modified such that the \(IRB_{8}\) block has \(4\)\(IRB_{6}\) blocks, and then the \(IRB_{7}\) block is integrated, the output of which for the 3D tensor is forwarded to the SAB block. The three outputs of SAB are then concatenated to be fed to a max pooling block, as shown in Figure 7. Similarly, in Figure 9, the original DensenNet201 architecture has the \(DNB_{4}\) block before 32 blocks of \(DNB_{3}\) and then a batch normalization layer. When compared to this, in Figure 10, the proposed DenseNet201 with SAB has \(29\)\(DNB_{3}\) blocks after \(DNB_{4}\) and then a single \(DNB_{2}\) block is integrated. After that, batch normalization and ReLU operations are performed before embedding the proposed SAB block. In Figure 12, it can be seen that the proposed Xception model has \(10\)\(XEB_{4}\) blocks and a single \(XEB_{5}\), with \(XEB_{6}\) blocks following them; however, in the proposed Xception with SAB architecture, as shown in Figure 13, there are \(6\)\(XEB_{4}\) blocks, followed by a single \(XEB_{5}\) block, an activation function, and then the SAB block is integrated. Figure 8: Building blocks of the DenseNet201 model. Figure 10: The proposed architecture of the DenseNet201 model after embedding SAB. Figure 7: The proposed architecture of the InceptionResnetV2 model after embedding SAB. Figure 9: Minimized architecture of the DenseNet201 model. Algorithm 1 summarizes the method described in the provided text, using a structured and step-by-step approach that can be readily understood and implemented. It encapsulates the CSAM block, the processing steps within the spiking convolution layer, the application of the attention mechanisms, and the final classification step using Categorical Cross-Entropy Loss. ```
1:Input: Collection of spiking inputs \(l_{1}\), \(l_{2}\),..., \(l_{t}\)
2:Output: Processed features with attention mechanisms
3: Initialize spiking convolution layer with parameters \(\omega\), \(\beta\)
4:for each timestep \(T\)do
5:\(Gf_{t}=\sigma_{1}(\omega_{(m,\omega)}*\eta_{(t-1)}+\omega_{(m,\omega)}*I_{t}+ \beta_{m})\)
6:\(h_{t}=\sigma_{2}(\omega_{(n,\sigma)}*\eta_{(t-1)}+\omega_{(n,\sigma)}*I_{t}+ \beta_{n})\)
```  
**Algorithm 1** Convolutional Spiking Attention Module (CSAM)  
Figure 11: Building blocks of the Xception model. Figure 12: Minimized architecture of the Xception model. Figure 13: The proposed architecture of the Xception model after embedding SAB.