SCNet: Enhancing Few-Shot Semantic Segmentation by Self-Contrastive Background Prototypes

Jiacheng Chen, Bin-Bin Gao, Zongqing Lu, Jing-Hao Xue, Chengjie Wang, Qingmin LiaoarXiv 2021

Introduction

Few-shot semantic segmentation (FSS) is a challenging task that requires a model to segment objects of a previously unseen class in a query image, guided by only a few labeled support images. Traditional approaches typically follow a metric learning paradigm: they extract a representative feature vector, or foreground prototype, from the support set and attempt to match it with pixels in the query image.

However, this standard approach suffers from a significant background bias. By focusing exclusively on the foreground prototype, existing models treat the entire background of a query image as a single, monolithic "negative" class. This is problematic because backgrounds are semantically diverse (containing sky, water, buildings, etc.), and models often inadvertently learn to "memorize" potential novel classes as background during training, hindering their ability to recognize them later as targets.

Methodology: The SCNet Architecture

To address these limitations, the authors propose SCNet (Self-Contrastive Network). SCNet utilizes a twin-branch architecture designed to perform a more complete and balanced feature comparison by explicitly modeling the background.

The overall architecture of SCNet, featuring the class-specific and class-agnostic branches.

As shown in the architecture above, SCNet consists of two primary components:

  1. Class-Specific Branch: This follows the standard FSS pipeline, using the foreground prototype from the support image to generate a foreground mask for the query image.
  2. Class-Agnostic Branch: This is the core innovation. Instead of relying on support images for background information—which may be irrelevant to the query scene—this branch generates background prototypes directly from the query image itself.

Both branches share a convolution module ($g_\phi$) for feature comparison. This weight-sharing forces the network to learn a robust embedding space that understands the relationship between target objects and their surrounding context, effectively regularizing the model against background bias.

Self-Contrastive Background Prototypes

The innovation of the class-agnostic branch lies in how it handles the query image's background. Since the query mask is unknown, the model must discover background regions autonomously.

Detailed view of the Prototype Generation and Feature Alignment modules within the class-agnostic branch.

As illustrated in the detailed module view, the process involves:

  • Clustering: The model applies $k$-means clustering to high-level query features to partition the background into $n$ distinct semantic regions (e.g., separating "grass" from "sky").
  • Prototype Generation: It then generates prototypes for these specific regions and learns to associate query pixels with their corresponding background prototypes through a self-contrastive loss.
  • Inference Efficiency: Crucially, the background branch is only used during training as an auxiliary task. During inference, it is discarded, meaning the performance gains come at zero additional computational cost in terms of speed or memory.

Experimental Results

SCNet was evaluated on the standard PASCAL-5i and COCO-20i benchmarks, achieving new state-of-the-art (SOTA) results across various backbones (VGG-16, ResNet-50, and ResNet-101).

  • PASCAL-5i: Using a ResNet-101 backbone, SCNet achieved 64.0% mIoU in the 1-shot setting and 68.0% mIoU in the 5-shot setting, outperforming previous leaders like PFENet.
  • COCO-20i: On this larger and more complex dataset, SCNet demonstrated even more significant improvements, particularly in the 5-shot setting where it reached 44.8% mIoU, a roughly 2% absolute improvement over previous methods.

Conclusion and Future Work

SCNet demonstrates that the query image is often its own best reference for understanding background context. By treating the background as a collection of distinct semantic regions rather than a monolith, SCNet effectively mitigates prior bias and improves segmentation accuracy.

While highly effective, the authors note that the model still faces challenges with extremely small objects and complex scenes with high semantic overlap. Future research may explore adaptive clustering methods to dynamically determine the optimal number of background regions for each unique image, further refining the self-contrastive mechanism.

Summary updated

BibTeX
@misc{chen2021scnet,
  author = {Jiacheng Chen and Bin-Bin Gao and Zongqing Lu and Jing-Hao Xue and Chengjie Wang and Qingmin Liao},
  title = {{SCNet: Enhancing Few-Shot Semantic Segmentation by Self-Contrastive Background Prototypes}},
  year = {2021},
  eprint = {2104.09216},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.09216},
}
Figure