# DDL R-CNN: Dynamic Direction Learning R-CNN for Rotated Object Detection
## 3 Method
### Routing Function  
The conventional convolutional approach, which employs consistent parameters and sliding window directions for feature extraction in different RS images, struggles to effectively extract the spatial orientation features of targets that are rotated. The prevalent method to tackle this challenge involves rotating a convolutional kernel through a set of predefined angles to extract the multi-directional spatial features of the targets. However, this approach, which is dependent on pre-set angles, restricts the model's capacity to adapt to targets at any arbitrary angle. This limitation can lead to less accurate and incomplete extraction of spatial orientation features, ultimately diminishing the model's ability to generalize across different scenarios. To tackle this challenge, we have introduced the routing function, which carries out detailed feature extraction based on the input feature maps. By integrating spatial information and smoothly processing angle data, it generates \(\theta\), offering a preliminary estimate of the target's spatial orientation. This enhances the robustness and multi-directional capability of extracting spatial features of targets. Like the process for generating \(\theta\), creating the combined weights \(\lambda\) also involves detailed feature extraction and spatial information integration. However, these spatial features need to be mapped non-linearly to produce suitable combination weights (\(\lambda\)) that fall within the range of 0 to 1. These weights are subsequently employed to amalgamate the output feature maps derived from convolutional kernels at diverse rotation angles. The weights indicate the contribution of each kernel to the target's overall spatial feature representation, enabling the model to adaptively emphasize features in certain directions while suppressing others that might cause interference. This approach allows the model to synthesize information from different directions, resulting in a comprehensive feature representation that captures the spatial characteristics of the target more effectively. The general architecture of our proposed routing function is shown in Figure 2b. Figure 3: DDL R-CNN’s overarching architecture functions as a two-stage detection system, predicated on the Feature Pyramid Network (FPN). Initially, it employs an oriented Region Proposal Network (RPN) to produce oriented proposal boxes. Subsequently, the directed R-CNN head combined with the DDL module and the Boundary Center Region Offset Proposal Network (BC-ROPN) are used in the subsequent stage to classify these proposal boxes and fine-tune their spatial coordinates. For clarity, we have not depicted the FPN and classification branches oriented towards the RPN. Specifically, the feature map \(X\in[C_{in},H,W]\) is initially subjected to a lightweight deep convolution with a \(3\times 3\) kernel, followed by a linear mapping [2] and ReLU activation. This process begins with the refined extraction of features:  
\[x^{\prime}=\text{ReLU}(\text{LN}(X\cdot K)+b);\quad ReLU=\frac{1}{1+e^{-x}}; \quad\text{LN}(x+\epsilon)=\frac{x-\mu}{\sqrt{\sigma^{2}+\epsilon}}\gamma+\beta \tag{1}\]  
For Equation (1), the asterisk (\(\cdot\)) denotes the depthwise convolution operation. \(K\) is a convolution kernel with a size of \(3\times 3\). LN stands for layer normalization. \(b\) is the bias term of the convolution layer. ReLU is the activation function. Firstly, convolution effectively captures local spatial characteristics from the input feature map. The convergence rate and stability of the network during training can be improved by layer normalization. Then, the ReLU activation enhances the model's ability to capture non-linearities, allowing the network to detect more complex patterns. The formula generates the activated features \(x^{\prime}\), which are then pooled into a \(C_{in}\)-dimensional feature vector using average pooling. The averaged feature vector is passed on to two different branches.