WeakTr: Exploring Plain Vision Transformer for Weakly-supervised Semantic Segmentation

Lianghui Zhu, Yingyue Li, Jiemin Fang, Yan Liu, Hao Xin, Wenyu Liu, Xinggang Wang · DOI

Introduction

Semantic segmentation typically requires dense pixel-level annotations, which are prohibitively expensive to scale. Weakly-supervised semantic segmentation (WSSS) addresses this by utilizing image-level tags. However, existing WSSS methods using Vision Transformers (ViTs) often suffer from noise introduced by simply averaging attention heads and rely on inefficient multi-stage refinement processes. WeakTr is a novel framework designed to overcome these limitations by leveraging the inherent properties of plain ViTs through intelligent attention weighting and efficient online retraining.

Methodology

The WeakTr framework introduces two primary innovations to streamline the WSSS pipeline and improve localization accuracy:

Adaptive Attention Fusion (AAF) Module

Traditional ViT-based WSSS methods treat all attention heads equally, which often dilutes the localization signal because different heads focus on different regions (e.g., some on the object, others on the background). The AAF module learns to estimate the importance of each head using a small Feed-Forward Network (FFN) to generate dynamic weights. This allows the model to emphasize object-specific heads and suppress background noise, resulting in significantly cleaner and more complete "Fine CAMs."

The Adaptive Attention Fusion (AAF) module architecture, showing how dynamic weights are applied to self-attention maps to produce refined Class Activation Maps (CAMs).

Gradient Clipping Decoder

To replace slow offline pseudo-mask refinement (such as CRFs or random walks), WeakTr employs an online retraining method. It utilizes the magnitude of the gradient as a proxy for label quality. Based on the observation that pixels with smaller gradients are more likely to have correct labels, the decoder "clips" or ignores regions with high gradients during training. This enables the model to focus on learning from the most confident regions of the CAM seeds without requiring a separate, computationally heavy refinement stage.

Experimental Results

The model was evaluated on the PASCAL VOC 2012 and COCO 2014 benchmarks, two gold-standard datasets for computer vision.

Performance comparison of WeakTr against state-of-the-art methods. WeakTr achieves significant improvements in mIoU on both PASCAL VOC 2012 and COCO 2014 datasets.

Accuracy and Efficiency

WeakTr sets a new state-of-the-art for WSSS. On PASCAL VOC 2012, it achieved 78.4% mIoU on the validation set and 79.0% on the test set. On the more challenging COCO 2014 dataset, it reached 50.3% mIoU, outperforming the previous leading method, MCTformer, by a substantial 8.3%.

Beyond accuracy, the framework is 2.6x faster than the baseline MCTformer. While previous methods required roughly 30.3 hours for the full pipeline, WeakTr completes training in just 11.6 hours on a single GPU by bypassing the cumbersome multi-stage refinement process.

Key Insights and Discussion

The success of WeakTr stems from the realization that attention heads in ViTs are specialists. Statistical analysis confirms that different heads focus on specific positions and classes; weighting them transforms the ViT from a general feature extractor into a precise localization tool. Additionally, using gradients as a filter allows the network to self-correct, making it remarkably robust to the noise inherent in weak labels.

While highly effective, the selection of confident regions via gradient clipping requires a "clipping start value" to delay the process until initial training stabilizes and the global mean gradient drops. Future work will continue to explore the untapped potential of plain ViT architectures for weakly-supervised tasks, as these results indicate the performance ceiling has not yet been reached.

Summary updated

BibTeX
@misc{zhu2023weaktr,
  author = {Lianghui Zhu and Yingyue Li and Jiemin Fang and Yan Liu and Hao Xin and Wenyu Liu and Xinggang Wang},
  title = {{WeakTr: Exploring Plain Vision Transformer for Weakly-supervised Semantic Segmentation}},
  year = {2023},
  eprint = {2304.01184},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.01184},
}
Figure