通过聚焦物体区域,让SAM2视频分割更快更省资源。
Efficient-SAM2: Accelerating SAM2 with Object-Aware Visual Encoding and Memory Retrieval
- 用窗口路由机制只处理前景,背景走轻量捷径
- 仅计算关键帧的显著记忆令牌,节省90%以上计算
- 不改模型结构,小调整就能提速68%,适合实时应用
Segment Anything Model 2 (SAM2) 在视频对象分割任务中表现优异;然而其高昂的计算开销限制了在实时视频处理中的应用。尽管已有研究尝试提升SAM2效率,多数方法集中在轻量化主干网络的重新训练,对后训练加速探索较少。本文观察到SAM2具有类生物视觉的稀疏感知模式,为消除冗余计算提供了契机:1)在掩码解码器中,注意力主要集中在前景物体上,而早期图像编码器则具有广泛注意力范围,导致对背景区域产生不必要的计算;2)在记忆库中,每帧仅有少量标记对记忆注意力贡献显著,且显著区域具有时间一致性,全令牌计算冗余。基于此,我们提出 Efficient-SAM2,使SAM2能自适应聚焦于物体区域,同时消除无关计算,显著提升推理效率。具体地,针对图像编码器,提出物体感知稀疏窗口路由(SWR),通过前一帧解码器提供的一致性和显著性线索,将背景区域路由至轻量快捷分支;针对记忆注意力,提出物体感知稀疏记忆检索(SMR),仅允许每帧的显著记忆标记参与计算,并复用其首次回忆时的显著性模式。无需额外参数和训练开销,Efficient-SAM2 在 SAM2.1-L 模型上实现 1.68 倍加速,仅在 SA-V 测试集上损失 1.0% 准确率。
原文摘要 · Abstract (English)
Segment Anything Model 2 (SAM2) shows excellent performance in video object segmentation tasks; however, the heavy computational burden hinders its application in real-time video processing. Although there have been efforts to improve the efficiency of SAM2, most of them focus on retraining a lightweight backbone, with little exploration into post-training acceleration. In this paper, we observe that SAM2 exhibits sparse perception pattern as biological vision, which provides opportunities for eliminating redundant computation and acceleration: i) In mask decoder, the attention primarily focuses on the foreground objects, whereas the image encoder in the earlier stage exhibits a broad attention span, which results in unnecessary computation to background regions. ii) In memory bank, only a small subset of tokens in each frame contribute significantly to memory attention, and the salient regions exhibit temporal consistency, making full-token computation redundant. With these insights, we propose Efficient-SAM2, which promotes SAM2 to adaptively focus on object regions while eliminating task-irrelevant computations, thereby significantly improving inference efficiency. Specifically, for image encoder, we propose object-aware Sparse Window Routing (SWR), a window-level computation allocation mechanism that leverages the consistency and saliency cues from the previous-frame decoder to route background regions into a lightweight shortcut branch. Moreover, for memory attention, we propose object-aware Sparse Memory Retrieval (SMR), which allows only the salient memory tokens in each frame to participate in computation, with the saliency pattern reused from their first recollection. With negligible additional parameters and minimal training overhead, Efficient-SAM2 delivers 1.68x speedup on SAM2.1-L model with only 1.0% accuracy drop on SA-V test set.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。