Style Adaptation for Domain-adaptive Semantic Segmentation
Ting Li Jianshu Chao Deyu An



3D Guidance Law for Maximal Coverage and Target Enclosing with Inherent Safety
    Praveen Kumar Ranjan, Abhinav Sinha, Member, IEEE, Yongcan Cao, Senior Member, IEEE
P. K. Ranjan and Y. Cao are with the Unmanned Systems Lab, Department of Electrical and Computer Engineering, The University of Texas at San Antonio, TX- 78249 USA. Emails: praveen.ranjan@my.utsa.edu, yongcan.cao@utsa.edu.A. Sinha is with the GALACxIS Lab, Department of Aerospace Engineering and Engineering Mechanics, University of Cincinnati, OH- 45221 USA. Email: abhinav.sinha@uc.edu.

    
==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================



Unsupervised Domain Adaptation (UDA) refers to the method that utilizes annotated source domain data and unlabeled target domain data to train a model capable of generalizing to the target domain data. Domain discrepancy leads to a significant decrease in the performance of general network models trained on the source domain data when applied to the target domain. We introduce a straightforward approach to mitigate the domain discrepancy, which necessitates no additional parameter calculations and seamlessly integrates with self-training-based UDA methods. Through the transfer of the target domain style to the source domain in the latent feature space, the model is trained to prioritize the target domain style during the decision-making process. We tackle the problem at both the image-level and shallow feature map level by transferring the style information from the target domain to the source domain data. As a result, we obtain a model that exhibits superior performance on the target domain. Our method yields remarkable enhancements in the state-of-the-art performance for synthetic-to-real UDA tasks. For example, our proposed method attains a noteworthy UDA performance of 76.93 mIoU on the GTA→Cityscapes dataset, representing a notable improvement of +1.03 percentage points over the previous state-of-the-art results.



Unsupervised domain adaptation, Semantic segmentation, Style adaptation




§ INTRODUCTION



Neural Networks <cit.> and Transformers <cit.> have achieved great success in semantic segmentation tasks, but supervised tasks typically require a large amount of annotated data. Pixel-level annotation is needed, with at least an hour for each image <cit.>, which significantly increases the cost. One approach to address this problem is to utilize existing annotated data or easily obtainable synthetic data to train models and test them on target data. However, due to domain differences, the model's performance metrics often decline substantially when tested on target data. In order to obtain a more robust model, researchers have proposed UDA methods <cit.><cit.><cit.>, transferring knowledge from annotated source domain data to unannotated target data. 


















It has been proven that CNNs are sensitive to distribution shifts <cit.> in image classification. Recent studies <cit.> have shown that Transformers are more robust compared to these factors. 
In addition, CNNs mainly focus on texture <cit.>, while Transformers emphasize shape, which is more similar to human vision. Some researches have revealed significant differences between the induction bias of standard CNNs and human vision: humans primarily rely on object content (i.e., shape) for recognition <cit.>, while CNNs exhibit a strong preference for style (i.e., texture) <cit.>. This explains why CNNs are more susceptible to changes when switching between domains, as image style is more likely to vary across different domains. 


Early studies <cit.><cit.><cit.> have confirmed that feature distribution shifts caused by style differences mainly occur in the shallow layers of the network. This implies that the shallow layers' feature distribution in the network can reflect the style information of the input images.  Therefore, following these works' methods, we manipulate the style features of the feature maps in the shallow layers of the network. The feature extractor captures the style features of the target domain while preserving the content of the source domain. This approach weakens the style features of the source domain while enhancing the style features of the target domain, achieving style feature transfer. 










§ METHOD




 §.§ Image to Image Domain Adaptation


In UDA, we are given a source dataset as 
    D^s={(x_i^s,y_i^s)}_i=1^N_s
 where N_s is the number of the color images in the dataset, and y^s∈ℝ^H× W represents the associated semantic map of x^s∈ℝ^H× W×3. Similarly, 
    D^t={x_i^t}_i=1^N_t
 is the target dataset where true semantic labels are missing. Typically, segmentation networks trained on D^s exhibit performance degradation when tested on D^t. Here, we use Fourier Domain Adaptation (FDA) <cit.> and RGB adaptation to reduce the domain gap between the two datasets at the image-level.


FDA aims to minimize domain differences by replacing the low-frequency components in the target domain with those from the source domain. This is because low-frequency components can be inferred as the domain style. FDA has achieved significant improvements in semantic segmentation. Therefore, we employ the FDA method for data augmentation, as expressed by the formula:

    x^s→ t=ℱ^-1([β∘ℱ^A(x^t)+(1-β)∘ℱ^A(x^s),ℱ^P(x^s)])


The variables ℱ^A and ℱ^P denote the amplitude and phase components of the Fourier transform, respectively. In the inverse Fourier transform, the phase and amplitude components are remapped to the image space. The hyperparameter β determines the filter's size in the inverse Fourier transform.

Random RGB shift is a prevalent and widely adopted technique for data augmentation. Through our experimental observations, we fortuitously discovered that employing random RGB shift as a data augmentation technique significantly enhances the model's performance. Our hypothesis is that the image-level implementation of random RGB shift enables a closer resemblance between the style of the source and target domains, thereby mitigating the domain gap. Building upon the concept of random RGB shift, we introduce a RGB adaptation method as a solution for domain adaptation.

The mean value of each channel is calculated for RGB images x as follows:

    μ(x)=1/HW∑_h=1^H∑_w=1^Wx_hw



    x^s→ t=x^s+(μ(x^t)-μ(x^s))


The variables μ(s) and μ(t) represent the mean values of the source domain image and the target domain image, respectively, along the channel dimension. By employing this method, the content of the source domain image remains unaltered, thus preserving the availability of accurate labels. Additionally, it facilitates the closer alignment of the source domain image with the target domain image within the RGB space. 













 §.§ Style Adaptive Instance Normalization

In UDA methods, the primary factor causing domain shift is the disparity in styles across domains. The presence of domain shift constrains the models' capacity for generalization in both domain adaptation and domain generalization tasks. Previous studies have demonstrated that shallow features extracted by backbone networks possess the capability to capture style information in images. Established approaches typically characterize the style features of an image by computing the mean and standard deviation along the channel dimension of shallow features. 

    σ(x)=√(1/HW∑_h=1^H∑_w=1^W(x_hw-μ(x))^2+ϵ)


Conventional instance normalization can eliminate specific stylistic information from an image. Directly applying this method to UDA can diminish the network's capacity to learn the style information of the source domain images. However, it also disregards the style information of the target domain, resulting in diminished performance and limited generalization ability on the target domain. 


To decrease the network's ability to learn style information from the source domain images while enhancing the style information of the target domain images, we apply AdaIN <cit.> to replace the style information of the source domain images with that of the target domain images. Meanwhile, this method retains the content information of the source domain images. We term the proposed approach as Style Adaptive Instance Normalization (SAIN). The specific implementation formula is as follows:

    SAIN(x^s,x^t)=σ(x^t)(x^s-μ(x^s)/σ(x^s))+μ(x^t)


μ and σ represent the mean and standard deviation of the feature map in the channel dimension, respectively. 

By transferring the style of the target domain to the source domain during the training process, the network g_θ biased towards content no longer relies on the style of the source domain to make decisions but focuses more on content while also paying attention to the style of the target domain. During testing, we directly use network g_θ without SAIN to ensure the independence of predictions and reduce computational burden. Therefore, we replace the original loss function with a content-biased loss, shown as follows:

    ℒ_i^S=-∑_j=1^H× W∑_c=1^Cy_(i,j)^Slog SAIN(g_θ(x_i^S)^(j,c),g_θ(x_i^T)^(j,c))


Furthermore, we follow the consistency training in DA-Former, which involves training the teacher network on augmented target data using DACS <cit.>, while the teacher model generates pseudo-labels using non-augmented target images. 






§ EXPERIMENTS





 §.§ Implementation Details

The proposed method is applied to two challenging unsupervised domain adaptation tasks, where there are abundant semantic segmentation labels in the synthetic domain (source domain), but not in the real domain (target domain). The two synthetic datasets used are GTA5 <cit.> and SYNTHIA <cit.>, while the real domain dataset is CityScapes <cit.>. 







The proposed method is validated based on the DAFormer network and the Mix Transformer-B5 encoder <cit.>. All backbone networks are pretrained on ImageNet. In the default UDA setting, the MIC <cit.> masked image self-training strategy and the training parameters are used, including the AdamW optimizer, the encoder learning rate of 6×10^-5, the decoder learning rate of 6×10^-4, 60k training iterations, a batch size of 2, linear learning rate warm-up, 

and DACS <cit.> data augmentation.





























































































































 §.§ Evaluation

First, we integrate RGB adaptation with several significant UDA methods, including DAFormer <cit.>, HRDA <cit.> and MIC <cit.>, using the DAFormer framework. Table 1 demonstrates that RGB adaptation achieves notable improvement compared to previous UDA methods without RGB adaptation. 


Karras et al. <cit.> demonstrated that styles at different levels encode distinct visual attributes. Styles from fine-grained spatial resolution (lower levels in our network) encode low-level attributes like color and fine textures, whereas styles from coarse-grained spatial resolution (higher levels in our network) encode high-level attributes including global structure and textures. Therefore, the application of our SAIN module at the appropriate level is necessary to mitigate adverse style-induced biases. The networks from Block 1 to Block 4 become increasingly deeper. Figure 1 illustrates that the most notable improvement is achieved when applying SAIN in Block 3. However, applying SAIN to features at excessively low levels only has a limited impact on reducing feature biases. Additionally, using SAIN in excessively high-level styles may result in the loss of essential semantic information. Through our experimental findings, we discovered that the concurrent application of SAIN to both Block 2 and Block 3 results in optimal performance.

Visual comparisons are conducted with the second performer (i.e., MIC), which utilizes the same segmentation network backbone as ours. Figure 2 illustrates that our model's prediction results demonstrate higher accuracy. Additionally, our approach demonstrates strong performance on some common categories, including the first row with the terrain, wall in the second row and building in the third and truck in fourth rows. We attribute this phenomenon to the transferability of RGB adaptation and SAIN, which enables the model to learn more style information from the target domain. 







 §.§ Influence of Style on UDA

In the following, we analyze the underlying principles of our method on GTA→Cityscapes. Firstly, we analyze the impact of SAIN on UDA at various feature levels. As shown in Figure 1, as the network depth increases from Block 1 to Block 3, the improvement in the performance of UDA using SAIN also increases accordingly. The results in Table 2 and Table 3 demonstrate significant performance improvements across all benchmarks. In particular, our method has led to a +1.03 increase in mIoU for GTA→CS and a +1.05 increase for Synthia→CS. 

For most categories, such as building, fence, rider, truck, and train, there is a certain performance improvement. However, there are also some categories that have a slight performance decrease after using SAIN, such as bike. This may be due to the difference in annotation strategies for the bike category between the Cityscapes dataset and the GTA dataset. 










§ CONCLUSION

We have proposed a straightforward method for reducing domain discrepancy, which requires no additional learning and can be seamlessly integrated into self-supervised UDA. By transferring the target domain style to the source domain within the latent feature space, the model is trained to prioritize the style of the target domain during its decision-making process. Our experiments validate the remarkable performance enhancements achieved by our proposed method in Transformer-based domain adaptation. Despite its simplicity, the results indicate that our method actually surpasses the current state-of-the-art techniques. This suggests that the distributional misalignment caused by shallow-level statistics can indeed impact cross-domain generalization, but it can be mitigated through image translation and SAIN. The issue of model robustness in machine learning remains a challenging problem, and while we do not assert that our method is optimal, its simplicity may also yield performance improvements in other domain adaptation tasks.



Acknowledgements: This work is supported by STS Project of Fujian Science and Technology Program (No. 2023T3042). 













































IEEEbib


