# Integrating Explanations into CNNs by Adopting Spiking Attention Block for Skin Cancer Detection
## 3 Proposed Methodology  
Since most CNN frameworks fail to account for how various inter-dependencies affect spatial dimensions, the problem is solved by the proposed CSAM model. This block incorporates spatial attention and channel attention components to selectively capture and emphasize meaningful inter-dependencies from spatial channels. Figure 2 presents an overview of the proposed CSAM model; Figure 3 illustrates the internal architectures of spatial attention and channel attention, and Figure 4 outlines the architecture of the proposed SAB, which consists of two CSAM models. The total number of CSAMs embedded in the proposed SAB is selected after extensive experiments. The addition of a spiking convolutional layer [25] to CSAM is motivated by its capacity to extract spatial features, enabling precise processing of the input data. Spiking convolution is analogous to CNN convolution and addresses the limitations of the normal convolution layer in handling three-dimensional data. As spiking convolution uses event-based computation that processes only significant changes, this approach naturally incorporates temporal dependencies and efficiently handles sparse data, making spiking convolutions suitable for tasks that require capturing both spatial and temporal patterns. The fundamental principle of spiking convolution, unlike traditional convolution, centers around the gate structure and cell state, \(c_{t}\), which effectively transmits pertinent informa  
Figure 4: Architecture of the proposed SAB. Figure 3: Internal architecture of Spatial Attention Block and Channel Attention Block. Figure 2: Overall architecture of the proposed CSAM model. tion throughout the entire sequence-processing procedure. The gate structure acquires the ability to selectively retain or discard information during the training process. For the three-dimensional tensor, the last two dimensions stand for the physical dimensions of weight and height, and the first dimension represents depth, such as the number of channels, and these constitute the input to the spiking convolution. Data are processed iteratively at each step, \(T\), where the convolution operation is substituted as part of the connection procedure to refine features progressively within the network. This convolutional procedure leverages the current input and spatial dependencies from surrounding regions in a structure that facilitates transitions within feature maps, enhancing contextual representation. Although it loses some of the detail in high-resolution images with tiny pixels, striking convolution is better at dealing with dynamic spatial patterns, such as cancerous patches with unique variations in texture, color, and shape within a single image. These spatial distributions represent the irregular patterns or gradients that spiking convolution can more effectively capture due to its sensitivity to spatial dynamics within the image. To be more precise, when provided with a collection of spiking neurons, \(I_{1}\), \(I_{2}\),..., \(I_{t}\), the gates and states can be described as follows:  
\[Gf_{t}=\sigma_{1}((\omega_{(m,\sigma)}*\eta_{(t-1)})+(\omega_{(m,\sigma)}*I_{t })+\beta_{m}) \tag{1}\]  
\[h_{t}=\sigma_{2}((\omega_{(n,\sigma)}*\eta_{(t-1)})+(\omega_{(n,\sigma)}*I_{t })+\beta_{n}) \tag{2}\]  
\[Go_{t}=\sigma_{1}((\omega_{(q,\sigma)}*\eta_{(t-1)})+(\omega_{(q,\sigma)}*I_{ t})+\beta_{q}) \tag{3}\]  
\[Sc_{t}=(Gf_{t}\odot Sc_{(t-1)})+(Gf_{t}^{\prime\prime}\odot h_{t}) \tag{4}\]  
\[H_{t}=Go_{t}\odot Sc_{t} \tag{5}\]  
Here, the symbol \(t\) represents the current state, \(m\) is the subscript for the forget gate, \(o\) is the subscript for the spiking neuron, \(n\) is the subscript for the auxiliary input gate, and \(q\) is the subscript for the output gate. The symbol \(\odot\) denotes the Hadamard product, and \(*\) symbolizes the convolution operation; the spike activations \(\sigma_{1}\) and \(\sigma_{2}\) transform a neuron's activation value into a spike when it exceeds the threshold value, respectively.