提出StructSAM,让SAM模型加速同时保留边界精度。
StructSAM: Structure- and Spectrum-Preserving Token Merging for Segment Anything Models
- 基于梯度能量与平滑性筛选,保护边界和提示区域
- 编码器算力降低25%-30%,分割精度损失微小
- 适合需要快速推理的医学图像分割场景
现有视觉变换器的令牌合并技术虽能显著提速,但直接应用于分割任意模型(SAM)面临挑战:SAM的图像编码器结合了窗口化与全局注意力,掩码解码器依赖密集提示条件特征以实现精确边界预测。本文在无训练条件下严格评估主流合并方法在SAM及Medical SAM上的表现,发现现有目标选择启发式策略会随合并率升高导致边界模糊与提示信息泄露。为此提出 extbf{StructSAM},一种保留分辨率的合并-还原框架:通过一阶特征梯度计算轻量级令牌能量得分,采用网格平滑性筛查保护边界与提示区域,并在平坦区域向低能量目标合并且显式恢复令牌。进一步从谱图粗化视角证明,该得分引导合并相比随机或窗口受限基线具有有界拉普拉斯谱失真。在八个自然与医学基准上,StructSAM实现编码器25%-30%的浮点运算量降低(提示感知合并可达40%+),在相同计算量下持续优于ToMe、PiToMe、ToMeSD、VidToMe和ALGM,mIoU/Dice下降极小。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。