# DDL R-CNN: Dynamic Direction Learning R-CNN for Rotated Object Detection
## 3 Method
### Dynamic Direction Learning R-CNN (DDL R-CNN)  
The goal of DDL R-CNN is to leverage a lightweight, fully convolutional network to merge features from different levels and produce a set of sparse, oriented proposal regions. The original mechanism for rotating objects had ambiguous choices for angle regression, leading to substantial losses when large angles were selected. Additionally, with high-aspect-ratio targets, even small predicted angle changes could cause dramatic shifts in the loss function, resulting in unstable training. To address these challenges, the innovative rotation mechanism leverages the existing oriented proposal regions and the composite feature maps from the DDL module to enable a compact and rapid regression of rotated bounding boxes. This strategy not only significantly reduces the volume of parameters but also ensures that the loss function values remain within a reasonable range. The specific network structure is shown in Figure 3. The model assimilates the five-tiered features from the FPN, labeled as \(P2,P3,P4,P5,P6\), and attaches a consistent head to the feature set at each level. This head includes a \(3\times 3\) convolutional layer, along with two parallel \(1\times 1\) convolutional layers. Across all feature levels, we designate three horizontal anchor points at each spatial location, each associated with three distinct aspect ratios: 1:2, 1:1, 2:1. The pixel areas for these anchors on \(P2,P3,P4,P5,P6\) are \(32^{2},64^{2},128^{2},256^{2}\), and \(512^{2}\), respectively. The position of each anchor point \(a\) is specified by a four-dimensional vector \(a=(a_{x},a_{y},a_{w},a_{h})\), with \((a_{x},a_{y})\) identifying the anchor's central coordinates and \(a_{w}\) and \(a_{h}\) representing its width and height, respectively. One of the parallel \(1\times 1\) convolutional layers serves as the regression branch, which integrates the directional feature maps \(y(\Delta\alpha,\Delta\beta)\) produced by the DDL module, and then merges these features and outputs offsets for the proposal regions relative to the anchor points \(\delta=(\delta_{x},\delta_{y},\delta_{w},\delta_{h},\delta_{x}\cdot y_{\Delta \alpha},\delta_{y}\cdot y_{\Delta\beta})\). For every location on the feature maps, we produce A proposal regions, where A equals the number of anchors per location, specified as 3 in this paper. This causes the regression branch to output 6A results. The directional proposal regions are derived from decoding these regression results. The decoding procedure is detailed below:  
\[ \begin{cases}y=a_{y}+\delta_{y}\cdot a_{h},\quad x=a_{x}+\delta_{x}\cdot a_{w} \\ h=a_{h}\cdot e^{\Delta h},\quad\omega=a_{\omega}\cdot e^{\Delta\omega}\\ \Delta_{\alpha}=\omega\cdot\delta_{\alpha}\cdot y_{\Delta_{\alpha}},\Delta_{ \beta}=h\cdot\delta_{\beta}\cdot y_{\Delta_{\beta}}\end{cases}  \tag{8}\]  
The center coordinate of the predicted candidate region is \((x,y)\), and the dimensions of its outer bounding box are expressed as width \(w\) and height \(h\). The center point offsets at the top (bottom) and right (left) of the outer bounding box are denoted as \(\Delta\alpha\) and \(\Delta\beta\), respectively. Finally, based on the characteristics of the parameters \((\Delta\alpha,\Delta\beta,w,h,x,y)\), we designed a new oriented proposal region representation scheme, known as the Boundary Center Offset Representation, which is the BC-ROPN part shown in Figure 3. The process is illustrated in the right (tail) diagram of Figure 1b. The oriented bounding box \(O\) serves as the outer rectangle and the midpoint of its bounding box is indicated by the yellow dot. The vertices of the oriented bounding box \(O\) are represented by the black points. Specifically, we use the six parameters \(O=(\Delta\alpha,\Delta\beta,w,h,x,y)\) calculated through Equation (8) to represent the oriented bounding box. With these six parameters, we can assign four corrected (offset) vertex coordinate sets \(v=(v_{1},v_{2},v_{3},v_{4})\) for each proposal region.