# Tailhook Recognition for Carrier-Based Aircraft Based on YOLO with Bi-Level Routing Attention
## 2 Related Work
### Attention Mechanism  
The attention mechanism [13; 14; 15] is crucial in various tasks of deep learning and machine learning, helping to improve model performance. This mechanism is inspired by a specific function of the human visual system, which can quickly focus visual attention on areas of interest or importance [16]. By automatically weighting and selecting the input data, the attention mechanism enables neural networks to focus more on the critical parts of the data. The core idea is to effectively allocate the limited processing resources, giving priority to areas with a large amount of information while ignoring irrelevant information. In short, the attention mechanism acts like an intelligent filter that helps the model identify and utilize the most critical information from the vast amount of input data.  
The convolutional block attention module (CBAM) [17] can produce attention feature maps of channel and spatial dimensions successively. Then, the two types of feature map information are multiplied by the original input feature map to perform adaptive feature thinning and produce the final feature map.  
The feature map produced by the network backbone undergoes sequential channel and spatial attention through CBAM, thus highlighting important channels and spatial areas, respectively, guiding the network to pay greater attention to the features that contribute more to the final task. The flow of the CBAM module is depicted in Figure 2. First, the intermediate feature map is passed through the channel attention module to capture channel attention. The resulting attention weights are then applied to the intermediate feature map, producing a feature map with channel attention. Next, this feature map is fed into the spatial attention module to capture spatial attention, and the corresponding spatial attention weights are applied, resulting in the final output feature map.  
Figure 1: The network structure of YOLOv5. The network structure mainly consists of the input layer, backbone, neck, and detection head.  
Figure 2: Flowchart of the CBAM module. The description of the channel attention module is in Figure 3, and the description of the spatial attention module is in Figure 4.  
The channel attention module, depicted in Figure 3, processes the input feature map through global max pooling and global average pooling to compress the spatial dimension to one while preserving channel information. These pooled features are then processed through a shared multi-layer perceptron (MLP) for feature extraction. Finally, the extracted features from the MLP are combined, and a sigmoid activation is applied to produce the final channel attention weights.  
The spatial attention module, as shown in Figure 4, processes the feature map calculated by the channel attention module by applying global max pooling and global average pooling separately along the channel dimension. Then, the resulting features are fed into a convolutional layer for feature extraction. Lastly, the output undergoes sigmoid activation to derive the final spatial attention weights.  
After sequentially completing these two steps, the final feature map is obtained by multiplying the spatial attention features with the original feature map.