# Object Tracking Algorithm Based on Multi-Layer Feature Fusion and Semantic Enhancement
## 2 Method
### Construction of Object Semantic Enhancement Model
#### 2.1.3 An Object Enhancement Model Integrating Mask Features  
While the cross-attention mechanism does improve the model's focus on object regions to a certain degree, it may still cause attention to spread out or become misaligned in complex backgrounds or when there are multiple similar objects present. To tackle this problem, this paper incorporates a masking strategy during the cross-attention learning process of Layer2 and Layer3. The newly proposed model is called Transtftpn-Mask, with the goal of further filtering out key regions and suppressing unnecessary information. After each cross-attention fusion stage, the feature influence value--representing the association strength between each position in the search features and the template--is computed. These values are then sorted in descending order, and the top 60% of positions with the highest influence values are retained as salient regions. The influence values of the discarded feature points are set to zero, while those of the retained regions remain unchanged to form an updated search feature, which is then used in the next round of cross-attention learning. This mask is dynamically updated after each fusion stage, ensuring that the model consistently attends to the most relevant regions associated with the object. By incorporating this masking mechanism, the model is able to automatically identify and retain the most informative regions before each round of cross-attention computation, effectively suppressing background noise and irrelevant features. Compared to treating all regions equally, the dynamic filtering provided by the mask offers several advantages: first, it improves the focus of attention distribution, allowing the model to concentrate more effectively on the core area of the object and reducing the risk of attention drift; second, by diminishing the influence of low-relevance features, it enhances the model's discriminative capability in scenarios with similar objects or cluttered backgrounds; third, the mask helps reduce redundant computation, thereby improving feature utilization efficiency. Overall, the masking strategy not only improves the quality of feature fusion but also enhances the model's tracking robustness and stability in dynamic and complex scenes. Figure 5 takes Layer3 as an example to show the processing process of using a mask strategy for Layer3 features. The shape of the search feature X is H \(\times\) W, and the value of each position represents the degree of association between the feature point and the template feature, which is called the feature influence value in this paper. The search features are flattened into a sequence of the length H \(\times\) W. In the previous section, it is explained that the features of Layer2 and Layer3 undergo four rounds of cross-attention fusion. This paper dynamically generates feature masks according to the feature influence values of the search features output by each cross-attention and further optimizes the original feature influence values, which can effectively adjust the distribution of feature influence values. The feature points of the search feature are sorted from high to low according to the size of the feature influence value, and the sorted feature influence values are represented as \(v_{i}\), where \(i\) represents the sorted index, which is used to distinguish different feature points. Keeping a certain proportion of feature points with high feature influence values is helpful to improve the recognition and tracking performance of the model. Therefore, in order to determine the specific retention ratio, this paper conducted tests on the OTB-100 data, and the results are shown in Table 2. As can be seen from the table, when proportions of 40%, 50%, 80%, and 90% were retained, the success rate of the model was low. In addition, compared with the 70% feature points, the 60% feature points were retained with less computation, a higher success rate, and the best tracking effect, which could balance the problem of feature retention and suppression.