Papers › SAMRefiner: Taming Segment Anything Model for Universal Mask Refinement

SAMRefiner: Taming Segment Anything Model for Universal Mask Refinement

10 Feb 2025arXiv:2502.06756archive 2025-07-28

Yuqi Lin, Hengjia Li, Wenqi Shao, Zheng Yang, Jun Zhao, Xiaofei He, Ping Luo, Kaipeng Zhang

In this paper, we explore a principal way to enhance the quality of widely pre-existing coarse masks, enabling them to serve as reliable training data for segmentation models to reduce the annotation cost. In contrast to prior refinement techniques that are tailored to specific models or tasks in a close-world manner, we propose SAMRefiner, a universal and efficient approach by adapting SAM to the mask refinement task. The core technique of our model is the noise-tolerant prompting scheme. Specifically, we introduce a multi-prompt excavation strategy to mine diverse input prompts for SAM (i.e., distance-guided points, context-aware elastic bounding boxes, and Gaussian-style masks) from initial coarse masks. These prompts can collaborate with each other to mitigate the effect of defects in coarse masks. In particular, considering the difficulty of SAM to handle the multi-object case in semantic segmentation, we introduce a split-then-merge (STM) pipeline. Additionally, we extend our method to SAMRefiner++ by introducing an additional IoU adaption step to further boost the performance of the generic SAMRefiner on the target dataset. This step is self-boosted and requires no additional annotation. The proposed framework is versatile and can flexibly cooperate with existing segmentation methods. We evaluate our mask framework on a wide range of benchmarks under different settings, demonstrating better accuracy and efficiency. SAMRefiner holds significant potential to expedite the evolution of refinement tools. Our code is available at https://github.com/linyq2117/SAMRefiner.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2502.06756")

Code

Syntology Ran 2 of 12 code samples harvested from 1 repository linked to this paper; 10 have no recorded run. Of those that ran: 2 ran · fixture could not drive it.

By repository: official repository: 12 samples from 1 repository, 2 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

linyq2117/samrefiner officialmentioned in papermentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

12 samples harvested; 2 ran; 0 honoured the contract we drafted; 10 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · fixture could not drive it
10unverified

Licence: 0 of the 12 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from linyq2117/samrefiner. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

get_rel_pos linyq2117/samrefiner/SAMRefiner_plus/segment-anything/segment_anything/modeling/image_encoder.py official repository ran · fixture could not drive it MIT (permissive) · 733d7f0bedcb74c2 · report
window_partition linyq2117/samrefiner/SAMRefiner_plus/segment-anything/segment_anything/modeling/image_encoder.py official repository ran · fixture could not drive it fingerprinted MIT (permissive) · 105fa08885dc36cc · report
build_sam_vit_b linyq2117/samrefiner/SAMRefiner_plus/segment-anything/segment_anything/build_sam.py official repository unverified MIT (permissive) · 37d02776691c6ccc · report
build_sam_vit_h linyq2117/samrefiner/SAMRefiner_plus/segment-anything/segment_anything/build_sam.py official repository unverified MIT (permissive) · 408c835829e1dadc · report
build_sam_vit_l linyq2117/samrefiner/SAMRefiner_plus/segment-anything/segment_anything/build_sam.py official repository unverified MIT (permissive) · e42540863d3b7880 · report
gaussian_2d linyq2117/samrefiner/SAMRefiner_plus/utils.py official repository unverified MIT (permissive) · a75b4ea06278636b · report
get_iou linyq2117/samrefiner/SAMRefiner_plus/iou_adaption_davis585.py official repository unverified MIT (permissive) · b8469730f63cb657 · report
get_iu linyq2117/samrefiner/SAMRefiner_plus/iou_adaption_davis585.py official repository unverified MIT (permissive) · f5f76587ff3a7654 · report
get_mask_embed linyq2117/samrefiner/SAMRefiner_plus/utils.py official repository unverified MIT (permissive) · a0228049b4df86da · report
mask_to_boundary linyq2117/samrefiner/SAMRefiner_plus/iou_adaption_davis585.py official repository unverified MIT (permissive) · b79a90dcf06de145 · report
prepare_image linyq2117/samrefiner/SAMRefiner_plus/utils.py official repository unverified MIT (permissive) · 73f5acb20532d93f · report
window_unpartition linyq2117/samrefiner/SAMRefiner_plus/segment-anything/segment_anything/modeling/image_encoder.py official repository unverified MIT (permissive) · 27be441cc8213e52 · report

Tasks

Semantic Segmentation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

SAM

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections