# Road Obstacle Detection Method Based on Improved YOLOv5
## 3 Methods
### Effective Multi-Scale Feature Fusion Module
#### 3.1.3 Effective Multi-Scale Feature Fusion Module  
During feature extraction, the low-level feature map typically preserves more local information, such as color and texture, associated with a smaller receptive field. This focus allows it to capture intricate details effectively, especially from small targets. As the number of convolutional or downsampling operations increases, the receptive field expands, leading to a higher degree of information redundancy, where individual pixel values begin to signify information from a larger region. At this stage, the feature map predominantly represents global information, facilitating the detection of medium and large targets.  
To strengthen the connections between different levels, prevent the emergence of isolated information \"islands\", and enhance the overall comprehensiveness of change detection, the Multi-Scale Feature Fusion (MFF) module has been proposed. Additionally, the incorporation of the _EMA_ attention module into this fusion results in the Efficient Multi-Scale Feature Fusion (EMFF) module. The MFF module is designed to integrate features across various levels, thereby improving the algorithm's responsiveness to scale variations. Its structure is illustrated in Figure 3.  
Figure 2: EMA module.  
Initially, the comprehensive set of information is maintained by channel-splicing high-level features with low-level features. This method utilizes \(1\times 1\) convolutions alongside three depth-separated parallel convolutions that employ different kernel sizes, as illustrated in (1) and (2). It effectively accommodates various size variations through diverse receptive fields. The implementation of depth-separated convolutions assists in reducing the overall number of parameters. Subsequently, channel splicing is performed again to guarantee the integrity of the extracted information, followed by point-wise convolution for channel downsampling, as depicted in (3). Essential scale information is captured using _EMA_, as detailed in (4).  
\[f_{1\times 1}^{Conv}=Conv_{1\times 1}\left(Concat(F,f)\right), \tag{1}\]  
\[f_{k\times k}^{DWConv}=DWConv_{k\times k}(Concat(F,f))k\in\{3,5,7\}, \tag{2}\]  
\[f_{cat}=Conv_{1\times 1}\Big{(}Concat\Big{(}f_{1\times 1}^{Conv},f_{3\times 3}^{ DWConv},f_{5\times 5}^{DWConv},f_{7\times 7}^{DWConv}\Big{)}\Big{)}, \tag{3}\]  
\[f_{cat}^{ema}=EMA(f_{cat}), \tag{4}\]  
In light of the validity of the initial input, crucial information is extracted from the original input features utilizing _EMA_ attention. This extracted information is subsequently multiplied with the original input to derive analogous features, as illustrated in (5) and (6).  
\[\hat{f}=EMA(f)\times f_{cat}^{ema}, \tag{5}\]  
\[\hat{F}=EMA(F)\times f_{cat}^{ema}, \tag{6}\]  
Finally, by summarizing the features obtained earlier, the aggregated information is derived through the _EMA_ attention mechanism, as shown in (7).  
\[f_{EMFF}=EMA\Big{(}Conv_{1\times 1}\Big{(}\hat{F}+\hat{f}+f_{cat}^{ema}+f+F \Big{)}\Big{)}, \tag{7}\]  
where \(F\),\(f\) represent the original input features, \(Conv_{1\times 1}\) is a \(1\times 1\) convolution, \(DWConv_{k\times k}\) represents a depth-separated convolution with convolution kernel size \(k\) (\(k\) = 3, 5, 7), Concat represents the channel splicing operation, and _EMA_ is the attention mechanism.  
The purpose of this multi-layer integration is to enhance spatial texture information by integrating multiple receptive fields to gain a more detailed and comprehensive understanding of change.