# Adaptive Feature Fusion for Small Object Detection
## 2 Materials and Methods
### Methods
#### 2.2.2 MMF-PANet Feature Fusion Module
In the fusion, all the information will be treated equally and fused indiscriminately, which will cause a problem. The background information of each feature is accumulated, so the network mistakenly believes that the received information is important information, and it is also used as the main feature for subsequent feature enhancement extraction, so it is easy to misjudge the detection of small objects and is counterproductive. In order to solve this problem, we added a fusion factor to each fusion path, which can improve the scale invariance of features and reduce the interference of background information to screen effective features for the network, reduce feature redundancy, and enhance the representation ability of small object features. It adaptively assigns weights to each fusion channel, and assigns different weights to the feature information from different levels, so that the fused features have both shallow high-resolution spatial information and deep feature detail semantic information, contacts the context content, and use the context information to detect small objects. We set a learnable fusion factor \(\alpha\) for the features that flow to the fusion path, and used weight normalization to constrain the value range of each weight so that \(\alpha\in(0,1)\). In order to prevent the gradient from disappearing due to zero weight, given a parameter \(e=0.001\), the network adjusts the weight according to the value of each feature tensor and controls the proportion of each feature map in the fused feature information to represent the importance of features at different scales. The dynamic adjustment of the fusion factor determines the retention of all information in each feature. The fusion factor is added to the optimizer as a hyperparameter, and is optimized along with the parameters of the optimizer until an optimal weight is learned. The feature calculation with the fusion factor added can be expressed as:  
\[F_{j}=f_{conv}(\frac{\alpha_{j}[1].P_{j1}^{in}+\alpha_{j}[2].P_{j2}  
tional overhead to the network model, through which critical features are promoted and suppressed that are not vital to the current task. Considering that both spatial position information and detailed semantic information may be the key to the accuracy of small object detection, the coordinate attention mechanism (CA) [39] and the convolutional block attention module attention mechanism (CBAM) [40] can be used as attention mechanisms to be added. Both CA and CBAM simultaneously filter the information of the two dimensions of feature channel and feature space, but their internal mechanisms and impact factors are different. Nevertheless, it is not only the type of attention mechanism that affects the capture of an area of an intensive object, but also the location of the joining modules. Thus, to obtain the effect of the two attention mechanisms on the network model, the following experiments were performed on them separately, and the experimental results are shown in Table 2.  
v1 in Table 2 means adding an attention mechanism between the backbone network and the neck, while v2 means adding an attention mechanism when the neck performs feature extraction. It can be seen from Table 1 that when CA and CBAM were added between the backbone network and the neck, it had a negative effect on the performance of the network. When the two were added to the neck separately, they showed different effects. CA did not affect the network performance improvement, while CBAM increased the mAP of the model by 0.17%. Therefore, we chose the CBAM to alleviate the problem of information interference caused by densely connected objects. Furthermore, in order to allow the initial features entering the attention mechanism to better focus on the foreground information, and to filter the background information that is highly similar to the small object, we improved the attention mechanism.