StructSAM: 面向分割一切模型的结构与谱保持令牌合并
StructSAM: Structure- and Spectrum-Preserving Token Merging for Segment Anything Models
AI总结:
针对SAM系列模型,提出StructSAM框架,通过基于梯度能量的令牌评分、网格平坦度筛选和合并-恢复机制,在保持边界和提示信息的同时减少计算量,实现25-30% FLOPs降低且性能损失极小。
摘要:
最近针对视觉Transformer(ViT)的令牌合并技术通过减少自注意力处理的令牌数量,通常无需重新训练即可大幅提升速度。然而,它们直接应用于分割一切模型(SAM)系列并非易事:SAM的图像编码器混合了窗口注意力和全局注意力,其掩码解码器依赖于密集的、提示条件化的特征进行精确边界预测。我们在严格的现成设置下,系统评估了SAM和Medical SAM上代表性的令牌合并方法,发现随着合并率增加,现有的目标选择启发式方法会侵蚀边界并泄露提示信息。我们提出了\textbf{StructSAM},一个专为SAM定制的保持分辨率的合并-恢复框架。StructSAM从一阶特征梯度计算轻量级令牌能量分数,使用基于网格的平坦度筛选来保护边界和提示区域,并在平坦区域内将令牌合并到低能量目标,同时进行显式令牌恢复。我们进一步提供了谱图粗化视角,表明与随机或窗口限制的基线相比,分数引导的合并产生的拉普拉斯谱失真是有界的。在八个自然和医学基准测试中,StructSAM将编码器FLOPs降低了25-30%(在提示感知合并下可达40%以上),同时mIoU/Dice下降很小,在相同计算量下始终优于ToMe、PiToMe、ToMeSD、VidToMe和ALGM。
英文摘要:
Recent token merging techniques for Vision Transformers (ViTs) provide substantial speedups by reducing the number of tokens processed by self-attention, often without retraining. However, their direct application to the Segment Anything Model (SAM) family is nontrivial: SAM's image encoder mixes windowed and global attention, and its mask decoder relies on dense, prompt-conditioned features for precise boundary prediction. We systematically evaluate representative token-merging methods on SAM and Medical SAM in a strict off-the-shelf setting, and find that existing destination-selection heuristics can erode boundaries and leak prompt information as merge rates increase. We propose \textbf{StructSAM}, a resolution-preserving merge-unmerge framework tailored to SAM. StructSAM computes a lightweight token-energy score from first-order feature gradients, uses grid-based flatness screening to protect boundary and prompt regions, and merges tokens within flat areas toward low-energy destinations with explicit token recovery. We further provide a spectral graph coarsening view showing that score-guided merging yields bounded Laplacian spectral distortion compared to random or window-restricted baselines. Across eight natural and medical benchmarks, StructSAM reduces encoder FLOPs by 25-30\% (up to 40\%+ with prompt-aware merging) with minor drops in mIoU/Dice, consistently outperforming ToMe, PiToMe, ToMeSD, VidToMe, and ALGM at the same compute.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。