# A Fast Dynamic Dim Target Tracking Approach for UAVs Using Improved Lightweight Siamese Networks
## 3 Materials and Methods
### Position-Wise Attention Module  
Attention modules commonly used for target tracking tasks include SENet [15], CBAM [16], ECA-Net [17], NAM [18], etc., which are mainly divided into channel attention and spatial attention. Channel attention focuses on the relationship across channels of the feature, and spatial attention focuses on the relationship within each pixel of the feature map channel. The position information attention module proposed in this paper adopts SENet channel attention. It adapts the specific implementation of both position information extraction and fusion weights to improve the network's ability to characterize the target.  
The process of the position information attention module is shown in Figure 3.  
To obtain global spatial information, channel attention usually uses global pooling to compress the global information into a channel descriptor. It is difficult to describe the location information with a single channel description. Therefore, in the part where the location information is extracted, a one-dimensional global pooling of the input feature maps is performed along the vertical and horizontal directions, respectively, which in turn leads to a vector of channel descriptions in both directions.  
\[\begin{array}{l}z_{c}^{h}(h)=\frac{1}{W}\sum\limits_{i=1}^{W}x_{c}(h,i)\\ z_{c}^{w}(w)=\frac{1}{H}\sum\limits_{i=1}^{H}x_{c}(j,w)\end{array} \tag{2}\]  
\(Z_{h}\) is the channel description vector obtained by averaging pooling along the horizontal X direction with a resolution of \(H\times 1\times C\). \(Z_{w}\) is the channel description vector obtained by averaging pooling along the vertical Y direction with resolution \(1\times W\times C\).  
Then, the fusion weights are generated. To facilitate the calculation of the weights, the vertical Y-direction matrix \(Z_{w}\) is rotated and spliced with the horizontal X-direction matrix \(Z_{h}\), and then enters the convolution layer with a convolution kernel of 1, the normalization layer and the ReLU6 nonlinear activation function layer to obtain the intermediate features \(f\):  
\[f=\delta\Big{(}F_{1}\Big{(}\Big{[}Z^{h},Z^{w}\Big{]}\Big{)}\Big{)} \tag{3}\]  
where \([*,*]\) is the rotational splicing transform, \(F_{1}\) is the convolution and normalization, and \(\delta\) is the nonlinear activation function ReLU6.  
The intermediate feature \(f\) is split into two independent features along the middle in the horizontal and vertical directions, and then into two convolutional layers with a convolutional kernel of 1 and a nonlinear function activation layer to obtain the weights in the two directions, respectively.  
\[\begin{array}{l}g_{h}=\sigma(F_{h}(f_{h}))\\ g_{w}=\sigma(F_{w}(f_{w}))\end{array} \tag{4}\]  
Figure 3: Position-wise attention mechanism.  
Eventually, the weights are expanded into a three-dimensional array with the same dimensionality as the input features along their respective directions and multiplied by bit with the input features to obtain the output feature map. In this way, we completed the rescaling of the features.  
\[\hat{X}(i,j)=X(i,j)\times g_{h}(i)\times g_{w}(j) \tag{5}\]  
\(\hat{X}(i,j)\) is the output feature map; \(X(i,j)\) is the input feature map.