TL;DR
MaskMerge is a novel token merging strategy that makes Vision Transformers (ViTs) significantly more efficient for instance segmentation without sacrificing accuracy. By using coarse, intermediate mask predictions to guide which tokens are combined, it prevents the "cross-instance fusion" error common in previous methods, achieving a superior accuracy-efficiency trade-off across diverse domains like medical imaging and aerial surveillance.
What Problem Does This Paper Address?
Vision Transformers (ViTs) have revolutionized computer vision, but they come with a heavy "attention tax": their computational cost grows quadratically with the number of image patches (tokens) they process. To speed them up, researchers often use token merging, which combines redundant tokens to reduce the workload.
However, existing merging methods like ToMe or ALGM rely almost entirely on feature similarity—if two tokens look alike in "feature space," they get merged. While this works for semantic segmentation (where you just need to know "this is all grass"), it fails miserably for instance segmentation.
In instance segmentation, the goal is to distinguish between individual objects of the same class. Imagine two identical-looking nuclei in a pathology slide or two white cars parked side-by-side. Because they look the same, similarity-based methods often merge them into a single blob. The authors call this failure mode cross-instance token fusion.
Methods
The authors introduce MaskMerge, a structure-aware framework that incorporates the model's own emerging understanding of object boundaries into the merging decision. The pipeline consists of two main stages:
- Local Token Merging: An initial step that merges highly redundant tokens within small spatial neighborhoods to reduce early-layer computation.
- Object-level Adaptive Token Merging (OLAM): This is the core innovation. Instead of just looking at how similar two tokens are, OLAM uses coarse, intermediate mask predictions from the model’s segmentation head. It enforces a simple rule: tokens can only be merged if they are predicted to belong to the same object instance.
To ensure robustness, they also include a mask confidence-aware constraint, only allowing merges when the model is reasonably sure about its instance assignments. Finally, a lightweight Token Unmerging step restores the tokens to their original spatial resolution before the final segmentation head, ensuring the output masks remain sharp.
Datasets
The authors evaluated MaskMerge on three datasets representing very different challenges:
- PanNuke: A histopathology dataset containing nuclei. This is a "crowded" domain where many small, visually identical instances are packed together.
- iSAID: High-resolution aerial imagery featuring 15 categories (like planes and cars). It’s characterized by small objects and high inter-instance similarity.
- Cityscapes: A standard urban driving dataset used to test the method's performance on more heterogeneous, real-world scenes.
Key Insights and Ideas
- Visual vs. Task Redundancy: The biggest "aha" moment is the realization that two tokens can be nearly indistinguishable in appearance (visual redundancy) but represent different entities for the task at hand (task-level distinctness). Merging should be task-aware, not just appearance-aware.
- Leveraging "Free" Information: Modern query-based models (like Mask2Former or EoMT) naturally produce intermediate mask proposals. MaskMerge treats these as "proxies" for structure, using information the model is already calculating to make the backbone more efficient.
- Aggressive Compression: Because the instance constraint makes merging "safer," MaskMerge can afford to be much more aggressive. It can reduce the token count significantly more than similarity-only methods before accuracy starts to drop.
Key Results
MaskMerge consistently outperformed state-of-the-art (SOTA) merging methods across various model scales (ViT-Small, Base, and Large).
- Efficiency Gains: On the PanNuke dataset, MaskMerge improved mAP from 30.1 to 32.1 compared to ALGM, while simultaneously slashing computation from 229 to 153 GFLOPs and increasing throughput by 1.18×.
- Aerial Performance: On iSAID, it boosted mAP by 3.1 points and ran 1.23× faster than the baseline.
- Pareto Frontier: As shown in Figure 1, MaskMerge defines a new state-of-the-art accuracy-throughput frontier, proving that instance-awareness is key to efficient dense prediction.
Limitations and Future Work
While highly effective, the authors note a few areas for further exploration:
- Overhead: Predicting coarse masks early in the network introduces a small amount of runtime overhead. While this is usually offset by the savings from token reduction, it's a factor to consider in extremely latency-sensitive applications.
- Dependency on Early Masks: The method's success relies on the model being able to produce at least "coarse" accurate masks in the middle of the encoder. If the initial mask predictions are completely wrong, the merging constraints might be less effective.
- Extension to Video: The authors suggest that the principle of structure-aware merging could be extended to video instance segmentation, where temporal consistency could provide even stronger constraints for token reduction.
Summary updated