## 2 Theoretical Foundations
### SWS Principle and Design  
Based on the simple attention mechanism (SimAM), we have introduced a slicing operation and proposed SWS, aiming to address the limitations of traditional attention mechanisms in small target segmentation in imaging logging. Unlike most existing attention modules, SimAM can infer 3D attention weights by simultaneously considering both channel and spatial dimensions, thereby enhancing the network's feature representation capabilities while maintaining its lightweight nature without increasing the parameter count. Figure 2: Comparison of bilinear interpolation and linear interpolation. Drawing inspiration from the spatial inhibition theory in neuroscience, which suggests that active neurons inhibit surrounding neuron activity to highlight important information, we calculate 3D attention weights through the following three steps [27]:  
The SimAM algorithm first establishes an energy function to quantify the degree of linear separability between a single neuron and its neighboring neurons within the same channel. A lower energy value indicates a greater distinction between this particular neuron and its surrounding counterparts, thereby highlighting its significance in visual processing. \[e_{t}(w_{t},\ b_{t},\ y,\ x_{i})=\left(y_{t}-\hat{t}\right)^{2}+\frac{1}{M-1} \sum_{i=1}^{M-1}\left(y_{o}-\hat{x}_{i}\right)^{2} \tag{9}\]  
Here, \(\hat{t}=w_{t}t+b_{t}\) and \(\hat{x}_{i}=w_{t}x_{i}+b_{t}\) are linear transforms of \(t\) and \(x_{i}\), where \(t\) and \(x_{i}\) are the target neuron and other neurons in a single channel of the input feature \(\mathbf{X}\in\mathbb{R}^{C\times H\times W}\). \(i\) is index over spatial dimension. \(M=H\times W\) is the number of neurons on that. \(w_{t}\) and \(b_{t}\) are the weight and bias of the transform. The transformed variables \(\hat{t}=w_{t}t+b_{t}\) and \(\hat{x}_{i}=w_{t}x_{i}+b_{t}\) represent linear transformations of \(t\) and \(x_{i}\), respectively. Here, \(i\) denotes the index and \(M=H\times W\) represents the total number of neurons. The weight \(w_{t}\) and bias \(b_{t}\) are utilized for this transformation process. Upon simplification, we obtain the final energy function. \[e_{t}(w_{t},\ b_{t},\ y,\ x_{i})=\frac{1}{M-1}\sum_{i=1}^{M-1}\left(-1-\left(w_ {t}x_{i}+b_{t}\right)\right)^{2}+\left(1-\left(w_{t}t+b_{t}\right)\right)^{2}+ \lambda w_{t}^{2} \tag{10}\]  
The next step involves deriving a closed-form solution for the energy function, which allows SimAM to efficiently calculate the significance of each neuron. Here, \(\hat{\mu}=\frac{1}{M}\sum_{i=1}^{M}x_{i}\) and \(\hat{\sigma}^{2}=\frac{1}{M}\sum_{i=1}^{M}\left(x_{i}-\hat{\mu}\right)^{2}\). \[\mu_{t}=\frac{1}{M-1}\sum_{i=1}^{M-1}x_{i} \tag{11}\]  
\[\sigma_{t}^{2}=\frac{1}{M-1}\sum_{i}^{M-1}(x_{i}-\mu_{t})^{2} \tag{12}\]  
\[w_{t}=-\frac{2(t-\mu_{t})}{\left(t-\mu_{t}\right)^{2}+2\sigma_{t}^{2}+2\lambda} \tag{13}\]  
\[b_{t}=-\frac{1}{2}(t+\mu_{t})w_{t} \tag{14}\]  
\[e_{t}^{*}=\frac{4\left(\hat{\sigma}^{2}+\lambda\right)}{\left(t-\hat{\mu} \right)^{2}+2\hat{\sigma}^{2}+2\lambda} \tag{15}\]  
The _sigmoid_ function is employed to confine the value of the energy function \(\mathbf{E}\) within the range of 0 and 1, thereby obtaining the weight of each neuron. Subsequently, the SimAM model ultimately leverages the significance of each individual neuron as its attention weight, enabling it to conduct element-wise multiplication with the feature map and thus attaining a weighted feature map. \[\widetilde{\mathbf{X}}=sigmoid\left(\frac{1}{\mathbf{E}}\right)\odot\mathbf{X} \tag{16}\]  
In Figure 3, The SimAM model employs a multi-head attention mechanism [28], facilitated by multi-layer stacking, to effectively capture long-range dependencies within the input sequence. By incorporating residual connections, the output of the multi-head attention layer is seamlessly integrated with the input sequence, ensuring preservation of all pertinent information.