NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

PEM: Prototype-based Efficient MaskFormer for Image Segmentation

Niccolò Cavagnero, Gabriele Rosi, Claudia Cuttano, Francesca Pistilli, Marco Ciccone, Giuseppe Averta, Fabio Cermelli

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.

Visual example of panoptic segmentation on a street scene, showing the model's ability to distinguish between 'things' like people and 'stuff' like buildings.

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.

Performance comparison of PEM against other models in terms of Panoptic Quality (PQ) and mean Intersection over Union (mIoU) versus Frames per Second (FPS).

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

BibTeX
@inproceedings{cavagnero2024pem,
  author = {Niccolò Cavagnero and Gabriele Rosi and Claudia Cuttano and Francesca Pistilli and Marco Ciccone and Giuseppe Averta and Fabio Cermelli},
  title = {{PEM: Prototype-based Efficient MaskFormer for Image Segmentation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
}
Figure