Masked Collaborative Contrast for Weakly Supervised Semantic Segmentation

Fangwen Wu, Jingxuan He, Yufei Yin, Yanbin Hao, Gang Huang, Lechao Cheng

Introduction

Semantic segmentation is a fundamental task in computer vision that requires pixel-level annotations, which are labor-intensive and expensive to obtain. Weakly Supervised Semantic Segmentation (WSSS) aims to alleviate this burden by training models using only image-level labels. Most existing WSSS methods rely on Class Activation Maps (CAMs) to generate pseudo-labels. However, CAMs often suffer from "greedy" behavior, focusing only on the most discriminative parts of an object (e.g., the head of a bird) rather than its full extent.

The MCC Framework

To address the limitations of CAM-based methods, researchers have introduced Masked Collaborative Contrast (MCC), a single-stage framework built on the Vision Transformer (ViT) architecture. Unlike previous methods that erase input pixels or use complex multi-stage pipelines, MCC operates directly within the transformer's attention mechanism.

Overview of the MCC framework.

The framework consists of two parallel branches: a standard self-attention branch and a masked self-attention branch. These branches share weights, ensuring that the model learns consistent representations while being forced to explore different regions of the image.

Masking Strategy and Contrastive Learning

The core innovation of MCC lies in how it handles information bottlenecking. Instead of masking the input image, which can destroy spatial context, MCC masks the affinity matrix—specifically the keys—within the self-attention layers.

Masked affinity matrix generation and strategies.

Masked Affinity Matrix

By masking columns in the affinity matrix, the model is prevented from attending to certain patches. This forces the transformer to find alternative visual cues to classify the image, leading to more comprehensive object coverage in the resulting CAMs. The authors found that high masking ratios (up to 75%) and varying down-sampling strategies for the masks help the model capture both local details and global structure.

Collaborative Contrastive Learning

MCC employs a collaborative contrastive loss ($\mathcal{L}_{mcc}$) to align local and global features. The model generates "local" class tokens from masked views and a "global" token from the unmasked view. Using an InfoNCE-based contrastive loss, the model pulls positive local instances (object parts) toward the global representation while pushing negative instances (background) away. This ensures that even partially observed object regions are correctly associated with the target class.

Experimental Results

The MCC framework was evaluated on the PASCAL VOC 2012 and MS COCO 2014 benchmarks. On PASCAL VOC, MCC achieved a mean Intersection over Union (mIoU) of 70.3% on the validation set and 71.2% on the test set, setting a new state-of-the-art for single-stage WSSS methods. On the more challenging MS COCO dataset, it reached 42.3% mIoU.

Qualitative results demonstrate that MCC produces significantly more complete segmentation masks compared to baseline methods, effectively capturing non-discriminative regions like the bodies of animals or the tails of airplanes.

Conclusion

Masked Collaborative Contrast (MCC) provides a robust solution for WSSS by leveraging the internal mechanisms of Vision Transformers. By masking the affinity matrix and employing collaborative contrastive learning, the model overcomes the "greedy" nature of traditional CAMs. While challenges remain in cluttered scenes and with intricate object structures, MCC represents a significant step toward high-quality semantic segmentation with minimal supervision.

Summary updated

BibTeX
@inproceedings{wu2024masked,
  author = {Fangwen Wu and Jingxuan He and Yufei Yin and Yanbin Hao and Gang Huang and Lechao Cheng},
  title = {{Masked Collaborative Contrast for Weakly Supervised Semantic Segmentation}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
  doi = {10.1109/wacv57701.2024.00091},
}
Figure