# Syn2 Real Detection in the Sky: Generation and Adaptation of Synthetic Aerial Ship Images
## 3 Methods
### Syn2 Real Object Detection Framework  
To facilitate operational object detection, we chose to apply a domain-adaptive object detection algorithm framework that was developed based on MMDetection [70]. In domain-adaptive object detection research, solving the domain transfer problem from the source domain to the target domain is crucial in order to address the variability between synthetic and real data. Below, we present some conceptual definitions to elucidate the principle of DAOD. A set of source images is called \(\mathbf{I}^{s}\). \(\mathbf{I}^{s}\) has a total of \(N\) object bounding boxes, with the set of boxes called \(\mathcal{B}^{s}\), \(\mathcal{B}=\{B_{j}|_{j=1}^{N},B_{j}=(x_{j},y_{j},w_{j},h_{j})\}\), and \(c\) object classes, with the corresponding class labels \(C^{s}\), \(C=\{C_{i}|_{j=1}^{N},C_{j}\in(0,1,2,\dots,c)\}\). Thus, we determined the representation of the source domain as \(\mathcal{D}_{s}\), \(\mathcal{D}_{s}=\{(I_{i}^{s},\mathcal{D}_{s}^{s},C_{i}^{s})|_{i=1}^{N}\}\). Since the target domain is not required to be labeled, we disregarded the existence of \(\mathcal{B}^{t}\) and \(C^{t}\) here. Corresponding to the representation of the source domain, the target images can be written as \(\mathbf{I}^{t}\), and the target domain can be written as \(\mathcal{D}^{t}\), \(\mathcal{D}^{t}=\{\mathbf{I}^{t}|_{i=1}^{N}\}\). The mean teacher (MT) model [71] aims to enhance the robustness of target domain prediction. However, it is often biased toward the source domain. To address this issue, we employed three domain-adaptation augmentation methods to facilitate image style transfer, thereby making the model more favorable toward the target domain data. These three methods, as illustrated in Figure 8, include Fourier domain adaptation (FDA) [72], histogram matching (HM) [73], and pixel distribution adaptation (PDA). The loss formula is defined as follows:  
\[\mathcal{L}_{det}(\mathbf{I}^{s},\mathcal{B}^{s},C^{s})=\mathcal{L}_{box}( \mathcal{B}^{s};\mathbf{I}^{s})+\mathcal{L}_{cls}(C^{s};\mathbf{I}^{s}), \tag{2}\]  
\[\mathcal{L}_{det}(\mathbf{P}^{s},\mathcal{B}^{s},C^{s})=\mathcal{L}_{box}( \mathcal{B}^{s};\mathbf{P}^{s})+\mathcal{L}_{cls}(C^{s};\mathbf{P}^{s}), \tag{3}\]  
where \(\mathcal{L}_{box}\) is the loss of predicted bounding boxes and \(\mathcal{L}_{cls}\) is the loss of the classification probability. Formula (2) is about source images. Formula (3) is about target-like images, and it only uses \(\mathbf{P}^{s}\) instead of \(\mathbf{I}^{s}\). Figure 7: Sample images from the SASI-ZERO and SASI-RANDOM datasets. The MT model [71] consists of a student model and a teacher model, both of which have identical architectures, as depicted in Figure 9, where the model is initially trained using the source dataset \(\mathcal{D}^{s}\), and the resulting \(\mathcal{J}_{sup}\) is equivalent to \(\mathcal{L}_{det}\). The teacher model generates pseudo-labels for the target domain. By setting an appropriate confidence threshold, false positives caused by noise can be eliminated, and \(\mathcal{L}_{unsup}\) is utilized to update the weights of the student model. The weights of the teacher model are then updated using the exponential moving average (EMA) formula, a commonly used smoothing technical indicator for smoothing time series data. The formulas are as follows:  
\[\mathcal{L}_{unsup}(\mathbf{I}^{s},\mathcal{B}^{t},\mathcal{C}^{t})=\mathcal{L}_{ box}(\mathcal{B}^{t};\mathbf{I}^{s})+\mathcal{L}_{cls}(\mathcal{C}^{t};\mathbf{I}^{s}), \tag{4}\]  
\[\theta_{t}\leftarrow\alpha\theta_{t}+(1-\alpha)\theta_{s}, \tag{5}\]  
where \(\theta_{t}\) are the weight parameters of teacher model, \(\theta_{s}\) are the weight parameters of the student model, and \(\mathcal{B}^{t}\) and \(\mathcal{C}^{t}\) are the pseudo-labels generated by the teacher model.