# SiamCAM: A Real-Time Siamese Network for Object Tracking with Compensating Attention Mechanism
## 3 Approach
### The Attention Model of Siamese Network  
The Siamese network extracts image features through the migration classification network, and the in-depth features of the image are biased towards semantic information. SiamRPN++ uses ResNet [19] as the backbone network to extract features. Experiments confirm that different channels respond differently to specific object categories, indicating that deep features can learn semantic information about object bias. The dual-branch structure of the Siamese network is different from the input image information, and the features extracted by the two branches have different concerns in dimensions such as channel and space. We use the attention mechanism to filter the image information and learn the importance of the object in the search branch during the feature extraction process. In other words, let the network extract target features that are more effective for the target tracking task, ignoring the background information. Because the information of a particular category of the image responds differently to different channels of the feature map, we use channel attention to enhance the characterization information of the object and search branch objects and weigh the channels with a stronger dependence on the object to obtain features maps with a more significant response. When the translation invariance of the feature extraction network is destroyed, the network is easy to learn the positional bias, which is the response to the object in the center is the greatest. In order to eliminate the positional bias caused by the data distribution of different datasets, we use the spatial attention mechanism to learn the location of the object, suppress the positional bias, and strengthen the representation of the physical location information of the object in the image. We introduce the CBAM (Convolutional Block Attention Module) [42] attention model. The attention mechanism model is a relatively lightweight and embeddable module. It  
Figure 2: The architecture of our approach. On the template branch, the channel-spatial attention module is the same as the CBAM module. The pale green part is the channel attention matrix, and the purple is the spatial attention matrix. On the search branch, the pale yellow is our compensatory attention matrix, and the purple is likewise spatial attention matrix. obtains a new feature map by calculating, weighting channel, and spatial attention on a specific layer of the feature extraction network. **Channel attention. ** The channel-wise attention is employed to select proper channels that adaptively facilitate the current tracking task. Given the input feature map \(Z^{i}\in\mathbb{R}^{H\times W\times C}\), where \(W\), \(H\), and \(C\) indicate the width, height, and channel number of feature maps, respectively. We first apply max-pooling and average-pooling operations through the spatial axis to get two 1D channel feature descriptors denoted as \(Z^{i}_{max}\in\mathbb{R}^{1\times 1\times C}\) and \(Z^{i}_{agg}\in\mathbb{R}^{1\times 1\times C}\). Then multiple layers of the perceptron are applied to each pooled feature descriptor to create a one-dimensional channel attention map \(W^{i}_{cz}\in\mathbb{R}^{1\times 1\times C}\). \[W^{i}_{cz}=sigmoid(MLP(Z^{i}_{max})\oplus MLP(Z^{i}_{agg}))\]  
where \(\oplus\) denotes the element-wise addition and \(MLP\) means the multi-layer perception. The multi-layer perception is composed of a channel reduction layer, which its \(\frac{C}{r}\times C\), and a ReLU activation, and a channel increasing layer, which its \(C\times\frac{C}{r}\) and a sigmoid activation. The Channel-Refined feature map \(F^{i}_{z}\in\mathbb{R}^{H\times W\times C}\) weighted with the channel attention can be calculated sequentially as,  
\[F^{i}_{z}=Z^{i}\otimes W^{i}_{cz}\]  
where \(\otimes\) indicates multiplication, respectively. **Spatial attention. ** We use spatial attention to emphasize areas of information that adequately represent the current target object.