# A Rotating Object Detector with Convolutional Dynamic Adaptive Matching
## 3 Method
### Dynamic Convolution  
As shown in Figure 2, we rotate the convolution to make the network more suitable for arbitrary directional RS object detection. Figure 1: The framework we propose consists of three parts: Dynamic Convolutional Module (DCM), Feature Pyramid, and Classification Detection Head. Firstly, the target angle is predicted using DCM and the convolutional kernel is rotated. Then, the extracted rotational features are input into the feature set pyramid to fuse multi-scale information. Finally, a gradient adaptive equalization loss function is used to perform equalization on the network. Figure 2: Firstly, to address the issue of feature errors in RS detection, we dynamically rotated the convolution to effectively extract features from multi-directional targets. Secondly, in order to solve the problem of imbalanced gradients in high-quality positive samples, a gradient adaptive equalization loss function was designed. **Spatial angle prediction**: A feature with the size \([C_{in},H,W]\) is input into the DCM module, firstly, through the calculation of \(3\times 3\) convolution kernels \(W_{3\times 3}\), followed by ReLU activation \(relu(\cdot)\) and average pooling \(ave(\cdot)\) to achieve efficient aggregation of the feature. The formula is expressed as follows:  
\[\mathbf{x}^{\prime}=ave(relu(W_{3\times 3}*\mathbf{x})) \tag{1}\]  
Then, the feature is input into two branches separately. The first branch consists of a linear layer and a softsign activation function. The range interval of the softsign activation function is \([-1,1]\), and the curve is smooth, used to predict the rotation angle \(\theta=[\theta_{1},\theta_{2},\cdots,\theta_{n}]\). The linear layer deviation is set to False to avoid angle errors. The formula is as follows:  
\[\theta=softsign(\mathbf{x}^{\prime}) \tag{2}\]  
where \(\theta\) represents the angle of the predicted rotating target, and \(\mathbf{x}^{\prime}\) is the feature of the rotating target extracted from the backbone network. The purpose of Formula (2) is to output the rotated target features extracted by the network as parameters to the softsign activation function and to calculate the angle of the rotated target. This angle serves as a parameter for rotational convolution, ultimately aligning the convolution with the remote sensing target in the spatial direction. \(softsign(\cdot)\) can be expressed as follows:  
\[softsign(\mathbf{x})=\frac{\mathbf{x}}{1+|\mathbf{x}|} \tag{3}\]  
The second branch consists of a linear layer with bias and a sigmoid activation function. The range interval of the sigmoid activation function is \([0,1]\), which is used to predict the combination weight \(\lambda=[\lambda_{1},\lambda_{2},\cdots,\lambda_{n}]\), and the formula is as follows:  
\[\lambda=sigmoid(\mathbf{x}^{\prime}) \tag{4}\]  
where \(\lambda\) is a set of weight vectors corresponding to \(\theta\). By weighted summation, the final prediction of the rotation target angle is made. \(sigmoid(\cdot)\) can be expressed as follows:  
\[sigmoid(\mathbf{x})=\frac{1}{1+exp(-\mathbf{x})} \tag{5}\]  
Due to the possibility of multiple targets being in the same image, considering spatial richness, spatial angle prediction is used to calculate a set of angles and a set of weights and to match the best rotational convolution kernel for different targets through weighted summation. The rotation angle \(\theta\) and multi-angle weighting factor \(\lambda\) obtained in the spatial angle prediction section are used as parameters and input into the second part of DCM to generate a rotation convolution kernel. **Dynamic rotation convolution**: If standard convolution is used for the feature extraction of multi-directional targets, the features shown in Figure 2(a) would be obtained. It can be seen that there is an angle between the convolution and the target, which can lead to an offset between the extracted features and the target, resulting in a large amount of invalid information in the features.