Beyond Background Shift: Rethinking Instance Replay in Continual Semantic Segmentation

Hongmei Yin, Tingliang Feng, Fan Lyu, Fanhua Shang, Hongying Liu, Wei Feng, Liang Wang · DOI

TL;DR

This paper tackles the challenge of "continual semantic segmentation" (CSS), where models must learn new visual categories over time without forgetting old ones. They introduce an "Enhanced Instance Replay" (EIR) method that intelligently replays instances of old classes within new images to combat background shift and improve performance. EIR significantly outperforms existing methods on standard CSS benchmarks.

What Problem Does This Paper Address?

Continual learning aims to equip models with the ability to learn new information sequentially without losing previously acquired knowledge. While this has been successful in image classification, applying it to semantic segmentation (where each pixel in an image is assigned a category) presents unique challenges. The core problem is "background shift": as new classes are learned, the way the model interprets and labels background regions can change. This is exacerbated by the "partial labeling" issue in continual semantic segmentation (CSS). When storing old data for replay, only the objects of interest are labeled, while everything else is treated as background. This means even stored "old" images might have new classes mislabeled as background, and new images might contain old classes that are now labeled as background. This ambiguity makes it difficult for the model to learn effectively and leads to catastrophic forgetting. Traditional image replay methods, which store entire images, struggle with this partial labeling and background shift, making them ineffective for CSS.

Methods

The paper proposes a novel Enhanced Instance Replay (EIR) method to address the limitations of existing approaches in CSS. EIR operates in several key stages:

  • Instance Storage: Instead of storing entire images, EIR stores individual instances (object crops) of old classes along with their labels in a memory buffer. This allows for more granular control over what is replayed.
  • Class Combination and Instance Selection: To avoid confusing context, EIR uses the old model to predict potential old classes within a new image. It then selects relevant old class instances from the memory buffer that match these potential classes and the context of the new image. This is a "pseudo-label" based selection strategy.
  • Instance Placement: A crucial innovation is the strategic placement of selected old class instances into new images. Instead of random placement, EIR identifies background-rich regions in the new image to place the instances, minimizing overlap with new class regions and reducing visual disruption. This is achieved by dividing the image into regions and selecting the top-left corner of the region with the highest background proportion.
  • Enhanced Training Strategy: EIR employs a Region-Specific Knowledge Distillation (RSKD) loss. This loss selectively enforces consistency between the old and new models' predictions. For pixels belonging to old classes or background, it aligns predictions from both models. For new class pixels, it encourages the new model to predict the correct new class. This is a more targeted approach than standard knowledge distillation, which can hinder learning new classes. The overall training objective combines a standard mBCE loss for the new image and the replayed instance with the RSKD loss.

Datasets

The proposed method is evaluated on two standard CSS benchmarks:

  • Pascal VOC 2012: A dataset with 20 classes.
  • ADE20K: A larger dataset with 150 classes.

The experiments are conducted under both "disjoint" and "overlapped" settings, with the overlapped setting being more challenging as it includes future classes in the training data.

Key Insights and Ideas

  • Instance-level replay is key for CSS: Storing entire images is problematic due to partial labeling. Replaying individual instances offers more flexibility and control.
  • Strategic placement matters: Randomly pasting old instances into new images can introduce noise and class inconsistency. Placing instances in background-rich areas is crucial for effective integration.
  • Contextual selection of instances is vital: Simply replaying any old instance isn't enough. Selecting instances that align with the context of the new image (using pseudo-labels from the old model) improves performance.
  • Targeted knowledge distillation is more effective: Standard knowledge distillation can hinder learning new classes. RSKD, by focusing on specific regions, better balances old knowledge retention and new knowledge acquisition.

Key Results

The proposed Enhanced Instance Replay (EIR) method significantly outperforms existing state-of-the-art methods on both Pascal VOC 2012 and ADE20K datasets across various experimental settings. For instance, on the Pascal VOC 5-3 overlapped setting, EIR achieves an mIoU of 74.61 for old classes, 63.13 for new classes, and 66.41 for all classes, substantially surpassing other replay strategies like "Image replay" (42.49 all) and "Vanilla instance replay" (53.14 all). Ablation studies confirm the effectiveness of each component of EIR, with the full method yielding the best results.

Limitations and Future Work

The authors acknowledge that while EIR significantly mitigates background shift, it cannot perfectly cover all background shift regions in new images using instances. This limitation suggests that further exploration is needed to fully resolve the issue. Future work could focus on more advanced techniques for instance placement and potentially exploring generative methods for creating more diverse and contextually relevant replay data.

Summary updated

Abstract

In this work, we focus on continual semantic segmentation (CSS), where segmentation networks are required to continuously learn new classes without erasing knowledge of previously learned ones. Although storing images of old classes and directly incorporating them into the training of new models has proven effective in mitigating catastrophic forgetting in classification tasks, this strategy presents notable limitations in CSS. Specifically, the stored and new images with partial category annotations leads to confusion between unannotated categories and the background, complicating model fitting. To tackle this issue, this paper proposes a novel Enhanced Instance Replay (EIR) method, which not only preserves knowledge of old classes while simultaneously eliminating background confusion by instance storage of old classes, but also mitigates background shifts in the new images by integrating stored instances with new images. By effectively resolving background shifts in both stored and new images, EIR alleviates catastrophic forgetting in the CSS task, thereby enhancing the model's capacity for CSS. Experimental results validate the efficacy of our approach, which significantly outperforms state-of-the-art CSS methods.
BibTeX
@inproceedings{yin2025beyond,
  author = {Hongmei Yin and Tingliang Feng and Fan Lyu and Fanhua Shang and Hongying Liu and Wei Feng and Liang Wang},
  title = {{Beyond Background Shift: Rethinking Instance Replay in Continual Semantic Segmentation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.00919},
}
Figure