FocSAM: Delving Deeply into Focused Objects in Segmenting Anything

You Huang, Zongyu Lan, Liujuan Cao, Xianming Lin, Shengchuan Zhang +2 more
2/9/2026

No official code found. Best implementation: YouHuang67/focsam (29 stars, MIT, last commit 2024-07-30).

Abstract

The Segment Anything Model (SAM) marks a notable milestone in segmentation models, highlighted by its robust zero-shot capabilities and ability to handle diverse prompts. SAM follows a pipeline that separates interactive segmentation into image preprocessing through a large encoder and interactive inference via a lightweight decoder, ensuring efficient real-time performance. However, SAM faces stability issues in challenging samples upon this pipeline. These issues arise from two main factors. Firstly, the image preprocessing disables SAM to dynamically use image-level zoom-in strategies to refocus on the target object during interaction. Secondly, the lightweight decoder struggles to sufficiently integrate interactive information with image embeddings. To address these two limitations, we propose FocSAM with a pipeline redesigned on two pivotal aspects. First, we propose Dynamic Window Multi-head Self-Attention (Dwin-MSA) to dynamically refocus SAM's image embeddings on the target object. Dwin-MSA localizes attention computations around the target object, enhancing object-related embeddings with minimal computational overhead. Second, we propose Pixel-wise Dynamic ReLU (P-DyReLU) to enable sufficient integration of interactive information from a few initial clicks that have significant impacts on the overall segmentation results. Experimentally, FocSAM augments SAM's interactive segmentation performance to match the existing state-of-the-art method in segmentation quality, requiring only about 5.6% of this method's inference time on CPUs. Code is available at https://github.com/YouHuang67/focsam.

View on arXivView PDF

Code Implementations(1)

YouHuang67/focsamCommunity100%
MIT
296CSS, ShellMar 21, 20242 years agoMIT

Similar Papers

Cite this paper

@article{huang2026focsam,
  title  = {FocSAM: Delving Deeply into Focused Objects in Segmenting Anything},
  author = {You Huang and Zongyu Lan and Liujuan Cao and Xianming Lin and Shengchuan Zhang and Guannan Jiang and Rongrong Ji},
  year   = {2026},
  eprint = {2405.18706},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/pdf/2405.18706},
  journal = {CVPR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.18706.svg)](https://codeofpaper.com/paper/2405.18706)

Discussion