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."
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.
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