# Aircraft Target Interpretation Based on SAR Images
## 3 Method
### Optimization Method of Adaptive Anchor Box  
In the process of network inference, an appropriately sized initial anchor box helps to accelerate network convergence. The network outputs some prediction boxes based on the initial anchor boxes. Compare the predicted box with the true box, calculate the difference between the two bounding boxes, then update and iterate the network parameters in reverse. The YOLOv5s uses the K-means algorithm to cluster anchor boxes in the dataset and obtain \(k\) clustering anchor boxes. The detailed steps are as follows:  
* Randomly selected \(k\) initial clustering anchor boxes \(C_{k}(w_{k},h_{k})\) from the dataset. (\(w\) is the width of the anchor box, \(h\) is the height of the anchor box).  
Figure 6: Mosaic synthetic image.  
Calculate the distance from all bounding boxes \(B_{i}(w_{i},h_{i})\) to \(C_{k}(w_{k},h_{k})\) as follows: (_i_ represents the total number of all bounding boxes) \[Distance(B_{i},\ C_{k})=1-IoU(B_{i},\ C_{k})\] (7)
* Classify bounding boxes \(B_{i}(w_{i},h_{i})\) into the relevant clusters based on the principle of nearest distance. Finally, classify all bounding boxes into \(k\) clusters.
* Recalculate the new clustering center boxes \(C_{k}(w_{k},h_{k})\), then repeat steps two, three, and four until the clustering anchor boxes remain unchanged.  
When selecting \(k\) initial clustering anchor boxes, the distance between anchor boxes should be as large as possible. Based on this concept, the paper proposed the K-means++ algorithm to optimize step one in the K-means algorithm. First, randomly select the first clustering anchor box, and calculate the distance from all bounding boxes to their nearest clustering anchor box to further calculate the probability of becoming a new clustering anchor box. Second, select a new clustering anchor box by the roulette wheel method at non-clustering samples. The further away the sample is from the original clustering anchor boxes, the more likely it is to become the next clustering center. Repeat this process until \(k\) cluster anchor boxes are selected. Because this paper adopted the 4 DDH method, the value of \(k\) is 12. The distribution of initial anchor boxes is shown in Figure 7. There are a total of 12 color regions, which represent different clusters. There are a total of 12 golden stars, which represent the size of the center anchor box of each cluster.  
Table 1 shows the detailed size of the initial anchor boxes between the original YOLOv5s and our improved YOLOv5s. P2, \(P3\), \(P4\), and \(P5\) represent the detection layers.  
\begin{table}
\begin{tabular}{c c c c c} \hline
**Detection Map Level** & \(P2\) & \(P3\) & \(P4\) & \(P5\) \\ \hline \multirow{3}{*}{Original YOLOv5s} & \multirow{3}{*}{-} & (10, 13) & (30, 61) & (116, 90) \\  & & (16, 30) & (62, 45) & (156, 198) \\  & & (33, 23) & (59, 119) & (373, 326) \\ \hline \multirow{3}{*}{Improved YOLOv5s} & (16, 15) & (35, 37) & (65, 79) & (94, 74) \\  & (23, 25) & (47, 61) & (73, 55) & (121, 98) \\ \cline{1-1}  & (34, 24) & (54, 43) & (85, 108) & (146, 135) \\ \hline \end{tabular}
\end{table}
Table 1: The initial anchor sizes between the original YOLOv5s and our improved YOLOv5s.  
Figure 7: The distribution of 12 initial anchor boxes in the SAR image dataset.