Abstract
Current attention-based methods for semantic segmentation mainly model pixel relation through pairwise affinity and coarse segmentation. For the first time, this paper explores modeling pixel relation via Class Activation Map (CAM). Beyond the previous CAM generated from image-level classification, we present Partial CAM, which sub-divides the task into region-level prediction and achieves better localization performance. In order to eliminate the intra-class inconsistency caused by the variances of local context, we further propose Partial Class Activation Attention (PCAA) that simultaneously utilizes local and global class-level representations for attention calculation. Once obtained the partial CAM, PCAA collects local class centers and computes pixel-to-class relation locally. Applying local-specific representations ensures reliable results under different local contexts. To guarantee global consistency, we gather global representations from all local class centers and conduct feature aggregation. Experimental results confirm that Partial CAM outperforms the previous two strategies as pixel relation. Notably, our method achieves state-of-the-art performance on several challenging benchmarks including Cityscapes, Pascal Context, and ADE20K.
Introduction
Semantic segmentation involves assigning a categorical label to every pixel in an image. A persistent challenge in this field is intra-class inconsistency, where pixels of the same category exhibit significant visual variance due to lighting, shadows, or perspective.
Existing attention mechanisms address this through two primary strategies:
- Pairwise Affinity: Methods like Non-local networks compute relations between every pair of pixels. While effective, this approach is computationally expensive ($O(N^2)$) and may fail to enforce global class consistency.
- Coarse Segmentation: Methods like OCRNet use global class centers to guide pixel labeling. However, a single global representation often overlooks local specificity—the unique appearance of a class within a specific image region.
This paper introduces Partial Class Activation Attention (PCAA), which repurposes Class Activation Maps (CAMs) to model pixel-to-class relations. By leveraging both local context and global consistency, PCAA achieves superior localization and consistency with significantly lower computational overhead than standard self-attention.
Methodology
The core of the proposed method is the PCAA module, which integrates local specificity with global categorical information to refine feature representations.
Partial Class Activation Map (Partial CAM)
While standard CAMs are typically used in weakly supervised learning for image-level classification, they often lack spatial precision. PCAA sub-divides the input image into an $S \times S$ grid of non-overlapping patches (e.g., a 4x4 grid). Region-level classification is performed on these patches to generate Partial CAMs, which provide significantly more accurate localization of objects compared to global CAMs.
Partial Class Activation Attention (PCAA)
The PCAA module operates in several stages:
- Local Class Centers: Within each patch, features are aggregated to form local class centers that capture the specific appearance of a category in that local context.
- Graph Convolutional Refinement: A Graph Convolution Unit (GCU) allows these local centers to exchange information across patches, refining their representations.
- Local-Global Fusion: The model calculates pixel-to-class similarity using local centers to ensure precise matching. It then aggregates global class representations based on these similarities to ensure the final segmentation is consistent across the entire image.
Experiments and Results
The PCAA framework was evaluated on three major benchmarks: Cityscapes, Pascal Context, and ADE20K.
Performance Benchmarks
- Cityscapes: PCAA achieved a state-of-the-art 82.3% mIoU on the test set, surpassing established models like DANet and OCRNet.
- Pascal Context: The method reached 55.6% mIoU.
- ADE20K: PCAA achieved 46.74% mIoU, demonstrating robustness on one of the most challenging segmentation datasets.
Computational Efficiency
Beyond accuracy, PCAA offers significant efficiency gains. By modeling pixel-to-class relations instead of pixel-to-pixel relations, the computational complexity is reduced from quadratic to linear relative to the number of pixels. Specifically, the PCAA module requires only 2.86 GFLOPs, an nearly 8x reduction compared to the 21.75 GFLOPs required by a standard Non-Local module.
Discussion and Conclusion
The primary contribution of this work is demonstrating that CAMs, traditionally a tool for weak supervision, can be effectively repurposed to provide high-quality guidance for fully supervised semantic segmentation. The "Partial" approach—sub-dividing the image to capture local nuances while maintaining global consistency—effectively resolves the conflict between local variance and intra-class consistency.
While Partial CAMs offer improved localization, they can still occasionally over-activate background regions or struggle with the interiors of very large objects. Future work may explore more advanced CAM generation techniques or extend the "Partial" attention concept to other computer vision tasks such as object detection and instance segmentation.
Summary updated