Papers › Surgical SAM 2: Real-time Segment Anything in Surgical Video by Efficient Frame Pruning

Surgical SAM 2: Real-time Segment Anything in Surgical Video by Efficient Frame Pruning

15 Aug 2024arXiv:2408.07931archive 2025-07-28

Haofeng Liu, Erli Zhang, Junde Wu, Mingxuan Hong, Yueming Jin

Surgical video segmentation is a critical task in computer-assisted surgery and is vital for enhancing surgical quality and patient outcomes. Recently, the Segment Anything Model 2 (SAM2) framework has shown superior advancements in image and video segmentation. However, SAM2 struggles with efficiency due to the high computational demands of processing high-resolution images and complex and long-range temporal dynamics in surgical videos. To address these challenges, we introduce Surgical SAM 2 (SurgSAM2), an advanced model to utilize SAM2 with an Efficient Frame Pruning (EFP) mechanism, to facilitate real-time surgical video segmentation. The EFP mechanism dynamically manages the memory bank by selectively retaining only the most informative frames, reducing memory usage and computational cost while maintaining high segmentation accuracy. Our extensive experiments demonstrate that SurgSAM2 significantly improves both efficiency and segmentation accuracy compared to the vanilla SAM2. Remarkably, SurgSAM2 achieves a 3× FPS compared with SAM2, while also delivering state-of-the-art performance after fine-tuning with lower-resolution data. These advancements establish SurgSAM2 as a leading model for surgical video analysis, making real-time surgical video segmentation in resource-constrained environments a reality. Our source code is available at https://github.com/jinlab-imvr/Surgical-SAM-2.

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

Code

Syntology Ran 9 of 16 code samples harvested from 1 repository linked to this paper; 7 have no recorded run. Of those that ran: 2 ran · honoured contract; 1 ran · violated contract; 4 ran · our draft was wrong; 1 ran · fixture could not drive it; 1 ran with no contract checked.

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

jinlab-imvr/surgical-sam-2 officialmentioned in papermentioned on GitHubpytorchApache-2.0 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

16 samples harvested; 9 ran; 2 honoured the contract we drafted; 7 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 · honoured contract
1ran · violated contract
4ran · our draft was wrong
1ran · fixture could not drive it
1ran
7unverified

Licence: 0 of the 16 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 jinlab-imvr/surgical-sam-2. “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.

build_sam2 jinlab-imvr/surgical-sam-2/sam2/build_sam.py official repository ran Apache-2.0 (permissive) · bbbfffe7be426cf5 · report
compute_axial_cis jinlab-imvr/surgical-sam-2/sam2/modeling/position_encoding.py official repository ran · violated contract Apache-2.0 (permissive) · 7ceaad42da42edd5 · report
get_1d_sine_pe jinlab-imvr/surgical-sam-2/sam2/modeling/sam2_utils.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · a6c3974188a5ffb0 · report
get_per_obj_mask jinlab-imvr/Surgical-SAM-2/tools/vos_inference.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 259650ecd92aae93 · report
init_t_xy jinlab-imvr/surgical-sam-2/sam2/modeling/position_encoding.py official repository ran · honoured contract fingerprinted Apache-2.0 (permissive) · bb060d29525f90eb · report
load_ann_png jinlab-imvr/Surgical-SAM-2/tools/vos_inference.py official repository ran · our draft was wrong Apache-2.0 (permissive) · fecc11868aafba36 · report
put_per_obj_mask jinlab-imvr/Surgical-SAM-2/tools/vos_inference.py official repository ran · honoured contract Apache-2.0 (permissive) · 2e947f9cfdf99dc6 · report
reshape_for_broadcast jinlab-imvr/surgical-sam-2/sam2/modeling/position_encoding.py official repository ran · fixture could not drive it Apache-2.0 (permissive) · f8f09f78b474ee7c · report
select_closest_cond_frames jinlab-imvr/surgical-sam-2/sam2/modeling/sam2_utils.py official repository ran · our draft was wrong Apache-2.0 (permissive) · 4ee20f090e58c425 · report
build_sam2_hf jinlab-imvr/surgical-sam-2/sam2/build_sam.py official repository unverified Apache-2.0 (permissive) · b532a4eee5754aee · report
build_sam2_video_predictor jinlab-imvr/surgical-sam-2/sam2/build_sam.py official repository unverified Apache-2.0 (permissive) · 4a1bbe17897a3ec2 · report
dice_loss jinlab-imvr/surgical-sam-2/training/loss_fns.py official repository unverified Apache-2.0 (permissive) · e473e66fedc883c7 · report
get_activation_fn jinlab-imvr/surgical-sam-2/sam2/modeling/sam2_utils.py official repository unverified Apache-2.0 (permissive) · f2e72d81f39d65cd · report
iou_loss jinlab-imvr/surgical-sam-2/training/loss_fns.py official repository unverified Apache-2.0 (permissive) · b8f501ca29e77f1a · report
sdp_kernel_context jinlab-imvr/surgical-sam-2/sam2/modeling/sam/transformer.py official repository unverified Apache-2.0 (permissive) · 6b7c7753844ee197 · report
sigmoid_focal_loss jinlab-imvr/surgical-sam-2/training/loss_fns.py official repository unverified Apache-2.0 (permissive) · 42fec6fdc1faf6f1 · report

Tasks

SegmentationVideo SegmentationVideo Semantic Segmentation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

PruningSAM

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