# RS-YOLOX: A High-Precision Detector for Object Detection in Satellite Remote Sensing Images
## 3 Proposed Methods
### Adaptively Spatial Feature Fusion (ASFF)  
In addition to using ECA to enhance the features captured by the backbone network, this article also optimizes the feature fusion of the neck network, adding an effective feature fusion algorithm: ASFF [38].  
The neck network of YOLOX adopts the structure of a multi-level feature pyramid: PAFPN. The structure enables the output of the neck network to combine both the location  
Figure 5: ECA block structure.  
information of the shallow network and the semantic information of the deep network, thereby achieving better regression and classification results. ASHF can be connected to PAFPN to perform feature fusion on the feature map processed by PAFPN, which can fuse similar features together, improving the detection performance. Figure 6 displays the structures of PAFPN and ASFF.  
As shown in Figure 6, the image will output three feature maps through PAFPN. We number them from top to bottom: feature map X\({}^{1}\), feature map X\({}^{2}\), and feature map X\({}^{3}\). Arrows in different colors represent feature transfer in different feature maps.  
X\({}^{1}\) has the largest receptive field and is suitable for detecting large objects in the picture, X\({}^{3}\) has the smallest receptive field and is suitable for detecting small objects, and X\({}^{2}\) has a receptive field in between, so it is used to detect medium-sized objects. ASHF takes the output (X\({}^{1}\), X\({}^{2}\), X\({}^{3}\)) of the PAFPN network as input for the fusion of three feature maps. The calculation process of ASHF includes two parts: feature resizing and adaptive fusion.  
Feature resizing involves scaling a feature map to the size of the feature map to be fused in order to ensure that the size of the feature map during feature fusion remains the same. We use X\({}^{1-3}\) to represent the image after X\({}^{1}\) is scaled to the size of X\({}^{3}\). Adaptive fusion is used to train three weight maps, \(\alpha\), \(\beta\), and \(\gamma\), through the network and multiply them with the input feature maps.  
Taking the input of ASHF-3 in Figure 6 as an example: (1) Perform feature scaling on X\({}^{1}\), X\({}^{2}\), and X\({}^{3}\) to obtain X\({}^{1-3}\), X\({}^{2-3}\), and X\({}^{3-3}\), respectively. (2) Use the network to train three weight maps (\(\alpha\), \(\beta\), and \(\gamma\)) with the same size as X\({}^{1-3}\), X\({}^{2-3}\), and X\({}^{3-3}\) and multiply each weight map and each input point by point to determine the activation and suppression of each pixel in the input feature map X to achieve feature fusion. (3) Add the three matrices obtained after point-by-point multiplication to obtain the output of the feature fusion result of small objects in ASHF. The formula for the above calculation is as follows:  
\[\text{ASFF-3}=\text{X}^{1-3}\otimes\alpha^{3}+\text{X}^{2-3}\otimes\beta^{3}+ \text{X}^{3-3}\otimes\gamma^{3} \tag{3}\]  
Through such calculation, the features of small objects are enriched in the feature map X\({}^{3}\) used to detect small objects (the features of the small objects in the feature map X\({}^{1}\) and the feature map X\({}^{2}\) are fused). At the same time, the activation values of the features of large objects and medium objects in the feature map X\({}^{3}\) are filtered out so that the model is more focused on detecting small objects. The branches of ASHF-1 and ASHF-2 are also based on the same principle. They both integrate the features of their own concern in the three feature maps and suppress unimportant features, which improves the accuracy of object detection. The datasets of satellite remote sensing images contain a large number of small objects. Using ASHF, the features of these small objects can be fused as much as possible, improving the detection of small objects.  
Figure 6: Structure of PAFPN and ASHF.