TL;DR
This paper introduces MCTformer+, a novel transformer-based framework that significantly improves weakly supervised semantic segmentation (WSSS) by generating more accurate, class-specific object localization maps. By leveraging multiple "class tokens" within a Vision Transformer and introducing novel contrastive learning and pooling strategies, the method achieves state-of-the-art performance on challenging WSSS benchmarks.
What Problem Does This Paper Address?
Traditional semantic segmentation requires pixel-level annotations, which are extremely labor-intensive and costly to obtain. Weakly Supervised Semantic Segmentation (WSSS) aims to overcome this by using less precise forms of supervision, such as image-level tags. A key challenge in WSSS is generating accurate "pseudo" pixel-level labels (localization maps) from these weak labels. Existing methods, often relying on Class Activation Mapping (CAM), produce coarse and imprecise localization maps. While Vision Transformers (ViTs) have shown promise in capturing global image context, their standard single "class token" struggles to differentiate and localize multiple object classes within a single image, leading to noisy and class-agnostic attention. This paper addresses the need for more discriminative and accurate class-specific localization maps for WSSS.
Methods
The core of the proposed method, MCTformer+, builds upon the Vision Transformer (ViT) architecture. Here's a breakdown of the key techniques:
- Multi-Class Tokens (MCTformer): Instead of a single class token, MCTformer introduces multiple class tokens, one for each object class. These class tokens interact with the image patch tokens through self-attention, allowing for class-aware interactions and the generation of class-specific attention maps.
- Class-Aware Training Strategy: To ensure each class token learns meaningful representations, a class-aware training strategy is employed. This involves a one-to-one correspondence between output class tokens and ground-truth class labels, directly supervising the learning of class-specific features.
- Contrastive Class Token (CCT) Module: To further enhance the discriminative power of class tokens and prevent overlap in localization maps, a CCT module is introduced. This module imposes a contrastive loss on the output class tokens from each transformer layer, encouraging them to be distinct from one another and to focus on unique class characteristics.
- Global Weighted Ranking Pooling (GWRP): For aggregating patch token features to predict class scores (in the CAM module), MCTformer+ replaces the standard Global Average Pooling (GAP) with GWRP. GWRP assigns weights to patch tokens based on their activation ranking, prioritizing more informative patches and leading to more accurate predictions and refined localization maps.
- Patch-Level Pairwise Affinity: The self-attention mechanism between patch tokens in the transformer naturally provides pairwise affinity information. This is leveraged to refine the generated class-specific localization maps, smoothing boundaries and improving continuity.
- Fusion with CAM: The framework seamlessly integrates with the Class Activation Mapping (CAM) module, combining class-specific transformer attention maps with CAM-derived maps (PatchCAM) for improved localization.
Datasets
The proposed method was evaluated on the following datasets:
- PASCAL VOC 2012: A standard benchmark for semantic segmentation.
- MS COCO 2014: Another widely used dataset for object detection and segmentation.
- OpenImages: Used for weakly supervised object localization, featuring a challenging multi-class single-label setting.
Key Insights and Ideas
- The Power of Multiple Class Tokens: The paper strongly advocates for the use of multiple class tokens in ViTs for WSSS. It argues that a single class token inherently mixes information from various classes, leading to class-agnostic and noisy localization. Multiple tokens allow for dedicated learning of class-specific features.
- Dense Supervision for Class Tokens: Simply having multiple class tokens isn't enough; they need to be trained to be discriminative. The CCT module provides a crucial insight: applying contrastive losses across all transformer layers, not just the final ones, is essential for fostering diverse and non-overlapping class-specific attention maps.
- Attention as Affinity: The inherent patch-to-patch attention in transformers provides a valuable, readily available source of pairwise affinity. This insight is crucial for refining localization maps without requiring additional complex training or supervision.
- GWRP for Better Aggregation: The paper highlights the limitations of simple pooling methods like GAP and GMP for aggregating patch features. GWRP's rank-based weighting strategy proves effective in focusing on salient features, leading to more accurate class predictions and improved localization.
Key Results
MCTformer+ demonstrates significant improvements over existing WSSS methods:
- PASCAL VOC: Achieved state-of-the-art performance, with a segmentation mIoU of 74.0% on the validation set and 73.6% on the test set. It outperformed previous methods by substantial margins, even surpassing those using additional saliency maps.
- MS COCO: Achieved a segmentation mIoU of 45.2%, outperforming recent methods.
- OpenImages: Achieved a pIoU of 55.6% and a PxAP of 72.8%, outperforming previous methods.
- Qualitative Results: Visualizations show that MCTformer+ generates more accurate, complete, and class-discriminative localization maps with reduced background noise and better handling of occlusion and small objects compared to its predecessor (MCTformer) and other methods.
Limitations and Future Work
- Limitations: The paper acknowledges that while CCT applied to all layers yields the best results, applying it only to the last layer results in a performance degradation. This suggests that the influence of the loss gradients on earlier layers might be limited, posing optimization challenges.
- Future Work: The paper implicitly suggests that further exploration of transformer architectures and their application to WSSS is a promising direction. The success of MCTformer+ also points towards the potential of leveraging transformer attention for more sophisticated WSSS tasks and datasets. The authors also provide their code and models publicly, encouraging further research.
Summary updated