# Adaptation of Object Detection Algorithms for Road Indicator Lights in Complex Scenes
## 2 Materials and Methods
### Attention Mechanisms Module  
The Convolutional Block Attention Module (CBAM), a convolutional block attention mechanism, can significantly improve the quality of feature representation in convolutional neural networks. CBAM improves the network's ability to represent important features by sequentially integrating two sub-modules, namely, channel attention and spatial attention, which sequentially focus on the positional information and the object information, thus improving the network's sensitivity of the network to important features. The CBAM module is designed to be seamlessly inserted after any convolutional layer of the CNN. It first recalibrates the feature map of each channel through the channel attention module, and then further recalibrates the importance of each location through the spatial attention module. This modular design allows CBAM to focus on the important information in the feature maps, effectively improving the expressiveness and accuracy of the model. The channel attention module aims to emphasize the feature channels that are more important for the final task, and it generates the attention weights for each channel mainly by using the spatial information of the feature map This process can be achieved in two steps:  
* Global Average Pooling and Global Max Pooling Input feature map \(F\in R^{C\times H\times W}\), where \(C\) is the number of channels, \(H\) and \(W\) are the height and width of the feature map, respectively. GAP and GMP are performed on the feature map to obtain two vectors \(F_{avg}^{C}\in R^{C}\) and \(F_{max}^{CC}\), which represent the average and maximum values of each channel, respectively. * Shared network weights and activation functions Apply a set of shared fully connected layers to \(F_{avg}^{C}\) and \(F_{max}^{C}\), then obtain the attention weights by ReLU activation function, and finally by sigmoid activation function: \[M_{c}(F)=\sigma\big{(}MLP\big{(}F_{avg}\big{)}+MLP(F_{max})\big{)}\] (1) where \(\sigma\) is the sigmoid function and MLP denotes a multilayer perceptual machine containing a set of fully connected layers, which learns the nonlinear interactions between channels through a process of compression and restart. The spatial attention module further refines the feature map by focusing on specific spatial locations. The processing steps of this module are as follows:  
* Aggregation of feature maps Using GAP and GMP along the channel processing, the feature maps adjusted for channel attention generate two 2D features \(F_{avg}^{HW}\in R^{H\times W}\) and \(F_{max}^{HW\times W}\). Figure 1: Overall network structure diagram. * Convolution and activation function  
Connect \(F_{avg}^{HW}\) and \(F_{max}^{HW}\), then pass through a \(7\times 7\) convolution layer, and finally apply a sigmoid activation function to obtain the spatial attention map:  
\[M_{\text{s}}(F)=\sigma\Big{(}f^{7\times 7}\Big{(}\Big{[}F_{avg}^{HW};F_{max}^{HW} \big{[}\big{]}\Big{]}\Big{)}\Big{)} \tag{2}\]  
where \(f^{7\times 7}\) denotes the \(7\times 7\) convolution operation and \(\sigma\) is the sigmoid function. CBAM can effectively focus on more meaningful feature channels and spatial regions, thus improving the model's ability to recognize key information and enhancing the model's performance. CBAM is designed to be simple and efficient and can be easily embedded into existing CNN architectures to provide performance enhancement for a variety of visual tasks. Efficient Channel Attention (ECA) is a mechanism used to enhance the performance of neural networks, especially when processing image data. It efficiently captures the relationship between different channels in the input feature map to improve the performance of the network for a specific task. Moreover, it is a lightweight channel attention model designed to enhance the performance of convolutional neural networks by minimizing computational complexity. ECA favorably affects the model's representational ability by dynamically adjusting the response strength of each channel to highlight more important features.