## 3 Method
### Multi-Target Domain Adversarial Learning Strategy  
During the multi-target domain adversarial learning strategy, in order to ensure relatively close feature distributions after spanning different domains and to better achieve transfer alignment between source and target domains, this paper added the adversarial loss terms \(L_{S\to T_{d}}\) and \(L_{S\to T_{d}}\) to the outputs of the daytime domain \(T_{d}\) and the nighttime domain \(T_{n}\), respectively. Both discriminators had identical structures, weights, and training protocols, where the identification source domain image was 1, and the target domain image was 0. The binary cross-loss function [42] was utilized to make both \(\tilde{F}_{T_{d}}\) and \(\tilde{F}_{T_{n}}\) close to \(F_{S}\). The antagonistic loss is defined as:  
\[L_{adv}=L_{S\to T_{d}}(X_{S},X_{T_{d}})+L_{S\to T_{n}}(X_{S},X_{T_{n}}), \tag{12}\]  
In the experiments, we trained the generator and the discriminators alternately. The generator used in the source domain \(G_{pre}\) was pre-trained, and the target domain \(G_{seg}\) was transfered. The objective functions of \(D_{S\to T_{d}}\) and \(D_{S\to T_{n}}\) are defined as:  
\[\begin{split} L_{S\to T_{d}}(X_{S},X_{T_{d}})=\min_{G_{seg}}\max _{D_{S\to T_{d}}}(& E_{X_{S}\sim P_{data}(X_{S})}(\log D_{S\to T_{d}}(G_{ pre}(X_{S})))+\\ & E_{X_{T_{d}}\sim P_{data}(X_{T_{d}})}(1-\log D_{S\to T_{d}}(G_{ seg}(X_{T_{d}})))),\\ & L_{S\to T_{n}}(X_{S},X_{T_{n}})=\min_{G_{seg}}\max_{D_{S\to T _{n}}}(& E_{X_{S}\sim P_{data}(X_{S})}(\log D_{S\to T_{n}}(G_{ pre}(X_{S})))+\\ & E_{X_{T_{n}}\sim P_{data}(X_{T_{n}})}(1-\log D_{S\to T_{n}}(G_{ seg}(X_{T_{n}})))),\end{split} \tag{13}\]  
We used cross-entropy loss to train the semantic segmentation loss of the source domain. Moreover, we introduced the small pixel reweighting \(w_{k}\) to address the small target category imbalance, as shown in Equation (15).  
\[L_{seg}=-\frac{1}{NC}\sum_{t=1}^{H_{x}w}\sum_{k=1}^{C}||w_{k}GT^{(t,k)}\cdot log (\hat{Y}_{S}^{(t,k)})||_{1}, \tag{15}\]  
where \(N\) is the total number of image pixels, \(k\) denotes category, \(||\cdot||_{1}\) is the \(L_{1}\) norm that sums up all the pixels, \(w_{k}\) is the pixel weight, \(\hat{Y}_{S}^{(k)}\) is the prediction map \(\hat{Y}_{S}\) from the \(k\)th channel of the source domain image obtained from the activation network \(N_{Y}\), i.e., \(\hat{Y}=N_{Y}(\hat{F})\), and \(GT^{(k)}\) is the ground truth of the \(k\)th category of the one-hot encoding. Specifically, for each category \(k\), we first defined a weight \(w^{\prime}_{k}=-\log(p_{k})\), where \(p_{k}\) denotes the percentage of all valid pixels that are labeled as category \(k\) in the source domain. Then, \(w_{k}\) was further normalized by \(w_{k}=((w^{\prime}_{k}-\overline{w})/\theta_{k})\cdot std+avg\), where \(\overline{w}\) and \(\theta_{k}\) are the mean and standard deviation of \(w^{\prime}_{k}\), respectively, and \(std\) and \(avg\) are preset constants to limit the value of \(w_{k}\) to positive. Finally, \(w_{k}\) was multiplied by the corresponding category channel in \(\bar{F}\) to generate the weighted probability map, and then the segmentation result was yielded via \(N_{Y}\), as shown in Equation (16).  
\[\hat{Y}^{(k)}=N_{Y}(w_{k}\cdot\bar{F}^{(k)}), \tag{16}\]  
where \(\hat{Y}^{(k)}\in\mathbb{R}^{H\times W\times C}\).  
Therefore, the total loss of the whole network is:  
\[L_{total}=L_{en}+L_{seg}+L_{de}+L_{adv}. \tag{17}\]In summary, we designed a segmentation network for decoupling body and edge. It predicted the body and edge features of the input image, applied \(L_{1}\) and \(L_{2}\) losses to constrain them, respectively, and was then synthesized into a segmentation feature map. After that, two discriminators were used to distinguish different domain outputs between source and daytime image and source and nighttime image in a multi-objective domain adversarial learning strategy. Additionally, probabilistic reweighting was used to optimize the segmentation prediction for small targets.