Class-conditional domain adaptation for semantic segmentation

Yue Wang, Yuke Li, James H. Elder, Runmin Wu, Huchuan Lu

Abstract

Training semantic segmentation models on synthetic data for real-world application often suffers from domain shift, where global alignment strategies fail to account for class-specific differences. This paper introduces Class-Conditional Domain Adaptation (CCDA), a method that aligns synthetic and real data on a class-by-class basis using a single, memory-efficient multi-scale discriminator. By incorporating patch-level logic and pixel-level entropy weighting, CCDA improves segmentation performance, particularly for rare and small objects, while maintaining a low computational footprint.

Introduction

Semantic segmentation—the task of assigning a class label to every pixel in an image—is vital for autonomous driving systems. However, creating large-scale, hand-labeled datasets for real-world environments is prohibitively expensive. Unsupervised Domain Adaptation (UDA) addresses this by training models on synthetic data (e.g., from video games) and adapting them to unlabeled real-world data.

A significant challenge in UDA is the "domain shift" between synthetic and real domains. While global alignment methods attempt to bridge this gap, they often overlook class-level nuances. For instance, while a synthetic "road" may align easily with a real one, a synthetic "pedestrian" or "bicycle" may differ significantly. Standard global alignment tends to favor dominant classes, leading to poor performance on infrequent but critical objects.

Problem Statement

Previous attempts at class-wise adaptation have utilized separate discriminators for each class. While effective, this "brute-force" approach scales poorly, consuming excessive GPU memory (e.g., ~170 MB for 19 classes). Furthermore, standard cross-entropy loss functions are biased toward classes with large spatial footprints, such as buildings or sky, further marginalizing rare objects during training.

Methodology

The CCDA framework introduces two primary components to achieve efficient, class-specific alignment:

1. Class-Conditional Multi-Scale Discriminator

Instead of an ensemble of networks, CCDA uses a single discriminator with two specialized branches:

  • Coarse-scale (Patch-level): The image is partitioned into patches. The discriminator identifies which classes are present in each patch and calculates an adversarial loss specifically for those classes. This ensures that even small objects, like a bicycle occupying only a few pixels in a patch, receive equal importance during adaptation.
  • Fine-scale (Pixel-level): This branch aligns features at the pixel level by identifying "ambiguous" pixels in the target domain—those where the model's prediction entropy is high. These pixels are upweighted during training to improve the model's certainty in complex regions.

2. Class-Conditional Segmentation Loss

To address class imbalance, the authors combine standard cross-entropy with Dice loss. Originally used in medical imaging for detecting small structures like tumors, Dice loss ensures that rare classes contribute equally to the learning process, preventing the model from over-optimizing for large background textures.

Experimental Results

The CCDA method was evaluated using synthetic source domains (GTA5 and SYNTHIA) and the real-world Cityscapes target domain.

  • GTA5 to Cityscapes: CCDA achieved a mean Intersection over Union (mIoU) of 40.0%, outperforming strong baselines such as CLAN (38.8%) and SSF-DAN (37.7%).
  • SYNTHIA to Cityscapes: The model reached 43.2% mIoU across 16 classes, demonstrating competitive performance with state-of-the-art methods.
  • Efficiency: By multiplexing class and domain predictions, CCDA reduced the discriminator's memory footprint to just 15 MB, a significant improvement over the ~170 MB required by competing class-wise methods.
  • Ablation Studies: The inclusion of Dice loss boosted performance by 1.5% mIoU, while the multi-scale discriminator added another 1.3%, confirming that the components work synergistically.

Conclusion

Class-Conditional Domain Adaptation (CCDA) provides a scalable and efficient solution for class-wise alignment in semantic segmentation. By focusing on patch-level presence and pixel-level ambiguity, the method significantly enhances the detection of infrequent and difficult classes. While the model still faces challenges with extremely small objects and crisp edge prediction in complex scenes, it sets a strong foundation for future work in multi-task learning and unsupervised video segmentation.

Summary updated

BibTeX
@article{wang2024class,
  author = {Yue Wang and Yuke Li and James H. Elder and Runmin Wu and Huchuan Lu},
  title = {{Class-conditional domain adaptation for semantic segmentation}},
  journal = {Comput. Vis. Media},
  year = {2024},
  doi = {10.1007/s41095-023-0362-4},
}
Figure