Papers › HRSAM: Efficient Interactive Segmentation in High-Resolution Images

HRSAM: Efficient Interactive Segmentation in High-Resolution Images

2 Jul 2024arXiv:2407.02109archive 2025-07-28

You Huang, Wenbin Lai, Jiayi Ji, Liujuan Cao, Shengchuan Zhang, Rongrong Ji

The Segment Anything Model (SAM) has advanced interactive segmentation but is limited by the high computational cost on high-resolution images. This requires downsampling to meet GPU constraints, sacrificing the fine-grained details needed for high-precision interactive segmentation. To address SAM's limitations, we focus on visual length extrapolation and propose a lightweight model named HRSAM. The extrapolation enables HRSAM trained on low resolutions to generalize to high resolutions. We begin by finding the link between the extrapolation and attention scores, which leads us to base HRSAM on Swin attention. We then introduce the Flexible Local Attention (FLA) framework, using CUDA-optimized Efficient Memory Attention to accelerate HRSAM. Within FLA, we implement Flash Swin attention, achieving over a 35% speedup compared to traditional Swin attention, and propose a KV-only padding mechanism to enhance extrapolation. We also develop the Cycle-scan module that uses State Space models to efficiently expand HRSAM's receptive field. We further develop the HRSAM++ within FLA by adding an anchor map, providing multi-scale data augmentation for the extrapolation and a larger receptive field at slight computational cost. Experiments show that, under standard training, HRSAMs surpass the previous SOTA with only 38% of the latency. With SAM-distillation, the extrapolation enables HRSAMs to outperform the teacher model at lower latency. Further finetuning achieves performance significantly exceeding the previous SOTA.

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="2407.02109")

Code

Syntology Ran 8 of 10 code samples harvested from 1 repository linked to this paper; 2 have no recorded run. Of those that ran: 8 ran with no contract checked.

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

youhuang67/high-resolution-segment-anything officialmentioned in papermentioned on GitHubpytorch 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

10 samples harvested; 8 ran; 0 honoured the contract we drafted; 2 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.

8ran
2unverified

Licence: 10 of the 10 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 youhuang67/high-resolution-segment-anything. “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.

calculate_file_sha256 youhuang67/high-resolution-segment-anything/mmsegmentation/.dev_scripts/gather_models.py official repository ran no licence file found · pointer only · a669df2cd07c07bb · report
compute_padding_size youhuang67/high-resolution-segment-anything/models/backbones/hrsam.py official repository ran fingerprinted no licence file found · pointer only · c487cc10368455e6 · report
dump_yaml_and_check_difference youhuang67/high-resolution-segment-anything/mmsegmentation/.dev_scripts/update_model_index.py official repository ran no licence file found · pointer only · b8bb3de40cf61c64 · report
expand_and_concat youhuang67/high-resolution-segment-anything/models/backbones/hrsam.py official repository ran no licence file found · pointer only · 223fe4cf438375b1 · report
get_collection_name_list youhuang67/high-resolution-segment-anything/mmsegmentation/.dev_scripts/update_model_index.py official repository ran no licence file found · pointer only · b9e0b82131912b70 · report
get_final_iter youhuang67/high-resolution-segment-anything/mmsegmentation/.dev_scripts/gather_models.py official repository ran no licence file found · pointer only · 88d68650d669bb11 · report
get_layer_id_for_vit youhuang67/high-resolution-segment-anything/engine/optimizers/vit_layer_decay_optimizer_constructor.py official repository ran fingerprinted no licence file found · pointer only · edd0eeba72aaf5e9 · report
process_checkpoint youhuang67/high-resolution-segment-anything/mmsegmentation/.dev_scripts/gather_models.py official repository ran no licence file found · pointer only · 4037fd6bcb9ca210 · report
get_model_info youhuang67/high-resolution-segment-anything/mmsegmentation/.dev_scripts/update_model_index.py official repository unverified no licence file found · pointer only · 75819240e9ae42d0 · report
ordered_yaml_dump youhuang67/high-resolution-segment-anything/mmdetection/.dev_scripts/gather_models.py official repository unverified no licence file found · pointer only · 8ff99a6bd2ebf598 · report

Tasks

Data AugmentationInteractive SegmentationSegmentationState Space Models

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AttentionBASEFocusSoftmax

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