Label Calibration for Semantic Segmentation Under Domain Shift

Ondrej Bohdal, Da Li, Timothy Hospedales

TL;DR

Adapting semantic segmentation models to new environments usually requires slow, computationally expensive retraining. This paper introduces a "near-free" method that improves performance under domain shift by simply recalibrating labels using soft-label prototypes in a single feed-forward pass, making it ideal for real-time applications like autonomous driving.

What Problem Does This Paper Address?

Deep learning models for semantic segmentation (assigning a class like "road" or "pedestrian" to every pixel) are notoriously fragile when they encounter a domain shift. A model trained on sunny, synthetic data (like GTA5) often fails when deployed in a rainy, real-world city.

While Source-Free Domain Adaptation (SFDA)—adapting a pre-trained model to a new unlabeled environment without needing the original training data—is a popular solution, most existing methods are too slow. They rely on backpropagation and multiple passes over the data, which is impractical for embedded systems or online deployment where a model needs to adapt on the fly. The authors ask: Can we achieve meaningful adaptation without backpropagation in a single pass?

Methods

The authors propose a fast, feed-forward adaptation procedure called Label Calibration.

Standard models make predictions by picking the class with the highest probability (the "argmax"). However, under domain shift, the model's output probabilities become distorted. Instead of a "road" pixel resulting in a clean one-hot vector like [1.0, 0.0, 0.0], the model might consistently output something like [0.84, 0.02, 0.08].

The core idea is to embrace this distortion:

  1. Prototype Construction: The model performs a single pass over the new (target) dataset. For every class, it calculates a "soft-label prototype"—a confidence-weighted average of all probability vectors the model predicted for that class.
  2. Nearest Prototype Prediction: During inference, instead of taking the highest probability, the model compares its predicted probability vector to all class prototypes. It assigns the pixel to the class whose prototype is closest in Euclidean distance.
Figure 1: Illustration of our method. Target domain data DT are used to construct a soft-label prototype for each class under domain shift (each prototype is a valid probability distribution). When we try to classify a pixel x to perform semantic segmentation, we use the pre-trained model to predict a vector of probabilities of the different classes. Rather than taking the most likely class, we make a prediction by finding the closest soft-label prototype to the predicted probability vector.

This method is "black-box" because it doesn't require access to or modification of the model's internal parameters; it only looks at the final outputs.

Datasets

The researchers evaluated their method on the classic synthetic-to-real benchmark:

  • Source Domains (Synthetic): GTA5 (frames from the video game) and Synthia (a large collection of synthetic urban scenes).
  • Target Domain (Real-world): Cityscapes (real-world urban driving sequences).
  • Architecture: They used a DeepLabv2 model with a ResNet101 backbone.

Key Insights and Ideas

  • Distortion as a Signal: The most profound insight is that the "errors" a model makes under domain shift are often systematic. By learning the "shape" of these errors (the soft prototypes), we can treat them as the new ground truth for that specific environment.
  • Efficiency is King: By avoiding backpropagation, this method is 200-300x faster than standard SFDA methods like GtA (Generalize then Adapt).
  • Calibration vs. Adaptation: The authors frame this as "label calibration" rather than full adaptation. It’s a lightweight layer on top of a frozen model that corrects for environmental bias.
  • Non-Trivial Prototypes: Visualization of the prototypes (see Figure 3 below) shows that the model learns distinct, non-trivial probability profiles for different classes, confirming that domain shift affects classes in unique, predictable ways.
Figure 3: Illustration of the soft-label prototypes for the two different source datasets.

Key Results

  • Performance Boost: The method provides a non-negligible improvement of approximately 1.0% mIoU (mean Intersection over Union) over a strong pre-trained baseline for both GTA5 and Synthia datasets.
  • Speed: As shown in Figure 2, the adaptation time is orders of magnitude lower than backprop-based methods. While full SFDA methods eventually achieve higher accuracy with enough time, the proposed method provides the best "bang for your buck" in resource-constrained scenarios.
  • Consistency: Unlike updating Batch Normalization (BN) statistics—a common fast adaptation trick that actually hurt performance in their tests—label calibration was consistently beneficial.
Figure 2: Comparison of the performance and adaptation time of the different methods.

Limitations and Future Work

  • Upper Bound Gap: While fast, the method does not reach the peak performance of heavy-duty SFDA methods that use backpropagation over thousands of iterations.
  • Static Prototypes: The current implementation uses a single pass to build prototypes. The authors suggest that moving to an online or streaming mode (updating prototypes continuously as new data arrives) would be a natural and powerful next step for truly autonomous systems.
  • Class Imbalance: If a class is never predicted during the initial pass, the method defaults to a standard one-hot vector, which may not be optimal.

Summary updated

Abstract

Performance of a pre-trained semantic segmentation model is likely to substantially decrease on data from a new domain. We show a pre-trained model can be adapted to unlabelled target domain data by calculating soft-label prototypes under the domain shift and making predictions according to the prototype closest to the vector with predicted class probabilities. The proposed adaptation procedure is fast, comes almost for free in terms of computational resources and leads to considerable performance improvements. We demonstrate the benefits of such label calibration on the highly-practical synthetic-to-real semantic segmentation problem.
BibTeX
@misc{bohdal2023label,
  author = {Ondrej Bohdal and Da Li and Timothy Hospedales},
  title = {{Label Calibration for Semantic Segmentation Under Domain Shift}},
  year = {2023},
  eprint = {2307.10842},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.10842},
}
Figure