Introduction
Image segmentation has seen a paradigm shift with the advent of the MaskFormer family, which unifies semantic, instance, and panoptic segmentation into a single transformer-based framework. However, these models are often computationally prohibitive for real-time or edge applications due to heavy cross-attention mechanisms and complex pixel decoders. PEM (Prototype-based Efficient MaskFormer) addresses these bottlenecks to deliver high-performance segmentation at significantly higher inference speeds.
Methodology
PEM introduces two primary innovations to optimize the standard Mask2Former pipeline for efficiency without sacrificing the flexibility of a unified architecture.
Prototype-based Masked Cross-Attention (PEM-CA)
Standard models require every object query to attend to every pixel in high-resolution feature maps, leading to quadratic complexity. PEM-CA mitigates this by identifying a single "prototype" visual token for each object query. By calculating a similarity matrix and using an argmax operation to select the most representative pixel for each segment, the heavy dot-product attention is replaced with a much cheaper element-wise interaction. This modification makes the module approximately $2\times$ faster than its predecessors.
Efficient Multi-scale Pixel Decoder
Instead of a transformer-heavy decoder, PEM utilizes a fully convolutional Feature Pyramid Network (FPN). To maintain the global awareness typically provided by transformers, the authors integrate Context-based Self-Modulation (CSM) to reweight channels based on global scene statistics and Deformable Convolutions to allow the network to adaptively focus on relevant image regions.
Experimental Results
The model was evaluated on the Cityscapes and ADE20K benchmarks, demonstrating a superior balance between accuracy and speed compared to existing state-of-the-art models.
On the Cityscapes dataset, PEM achieved 61.1 PQ at 13.8 FPS, which is nearly $3.4\times$ faster than Mask2Former with only a marginal drop in accuracy. In semantic segmentation tasks, it reached 79.9 mIoU, rivaling task-specific architectures like PIDNet while maintaining its multi-task flexibility. On ADE20K, PEM reached 38.5 PQ at 35.7 FPS, outperforming the efficient YOSO model in both accuracy and speed.
Conclusion
PEM proves that the redundancy inherent in image pixels can be leveraged to significantly speed up transformer-based segmentation. By replacing dense attention with prototype selection and using context-aware convolutions in the decoder, PEM achieves state-of-the-art efficiency for real-world, low-latency applications.
Summary updated