## 3 Methodology
### Multi-Scale Linear Spatial Attention Module  
The multi-scale linear spatial attention module structure mainly consists of a multi-stage backbone network. It employs the ReLU linear attention mechanism to capture global contextual information and enhances local information processing capability through a spatial information module. The model adopts multi-scale learning by aggregating multi-scale information of Q, K, and V to improve its multi-scale feature extraction ability. As illustrated in Figure 3, the input generates Q, K, and V through a linear layer. Q incorporates spatial information and enters the ReLU linear attention module. K passes through a 3 \(\times\) 3 convolution before entering the ReLU linear attention module. V goes through a 5 \(\times\) 5 convolution before entering the ReLU linear attention module. Since different convolutional kernel sizes are used, the receptive fields vary accordingly. Finally, the outputs from the three ReLU linear attention modules are concatenated. Then, a deformable convolution (Dconv) layer is applied to reduce the channel dimension back to its original shape. Given the input \(\mathrm{W_{V}}\in\mathbb{R}^{\mathrm{N\times f}}\), the generalized formulation of softmax attention is expressed as:  
\[\mathrm{O_{i}}=\sum_{\mathrm{j=1}}^{\mathrm{N}}\frac{\mathrm{Sim}\left(\mathrm{ Q_{i}},\mathrm{K_{j}}\right)}{\sum_{\mathrm{j=1}}^{\mathrm{N}}\mathrm{Sim}\left( \mathrm{Q_{i}},\mathrm{K_{j}}\right)}\mathrm{V_{j}} \tag{1}\]  
where:  
\[\mathrm{Q}=\mathrm{X_{in}}\cdot\mathrm{W_{Q}} \tag{2}\]  
\[\mathrm{K}=\mathrm{X_{in}}\cdot\mathrm{W_{K}} \tag{3}\]  
\[\mathrm{V}=\mathrm{X_{in}}\cdot\mathrm{W_{v}} \tag{4}\]  
\(\mathrm{W_{Q}}\), \(\mathrm{W_{K}}\), and \(\mathrm{W_{V}}\in\mathbb{R}^{\mathrm{N\times f}}\) are learnable linear projection matrices. \(\mathrm{O_{i}}\) represents the i-th row of matrix \(\mathrm{O}\). \(\mathrm{Sim}(\cdot,\cdot)\) is defined in Equation (5). Equation (1) transforms into the original softmax attention. \[\mathrm{Sim}(\mathrm{Q},\mathrm{K})=\exp(\frac{\mathrm{Q}\cdot\mathrm{K}^{ \mathrm{T}}}{\sqrt{\mathrm{d}}}) \tag{5}\]  
In addition to using the similarity function, other similar functions can also be used. We introduce linear attention [34] to achieve a global receptive field, rather than using  
Figure 3: Structure of the multi-scale linear spatial attention module. the more complex softmax-based attention mechanism [35]. In ReLU linear attention, the similarity function is defined as follows:  
\[\text{Sim}(\text{Q},\text{K})=\text{Relu}(\text{Q})\cdot\text{Relu}(\text{K})^{ \text{T}} \tag{6}\]  
ReLU linear attention is about 4 times faster than softmax attention under similar computations and exhibits better performance in terms of latency. Using Equation (6), Equation (1) can be rewritten as:  
\[ \begin{split}\text{O}_{\text{i}}&=\sum\limits_{ \text{j}=1}^{\text{N}}\frac{\text{ReLu}(\text{Q}_{\text{j}})\cdot\text{ReLu} (\text{K}_{\text{i}})^{\text{T}}}{\sum_{\text{j}=1}^{\text{N}}\text{ReLu}( \text{Q}_{\text{j}})\cdot\text{ReLu}(\text{K}_{\text{j}})^{\text{T}}}\cdot \text{V}_{\text{j}}\\ &=\frac{\sum_{\text{j}=1}^{\text{N}}\left(\text{ReLu}(\text{Q}_{ \text{j}})\cdot\text{ReLu}(\text{K}_{\text{j}})^{\text{T}}\right)\cdot\text{V} _{\text{j}}}{\text{ReLu}(\text{Q}_{\text{j}})\cdot\sum_{\text{j}=1}^{\text{N}} \text{ReLu}(\text{K}_{\text{j}})^{\text{T}}}\end{split}  \tag{7}\]  
Then, by leveraging the associativity of matrix multiplication, both computational complexity and memory usage can be reduced from quadratic to linear. \[