Papers › SAM 2: Segment Anything in Images and Videos

SAM 2: Segment Anything in Images and Videos

1 Aug 2024arXiv:2408.00714archive 2025-07-28

Nikhila Ravi, Valentin Gabeur, Yuan-Ting Hu, Ronghang Hu, Chaitanya Ryali, Tengyu Ma, Haitham Khedr, Roman Rädle, Chloe Rolland, Laura Gustafson, Eric Mintun, Junting Pan, Kalyan Vasudev Alwala, Nicolas Carion, Chao-yuan Wu, Ross Girshick, Piotr Dollár, Christoph Feichtenhofer

We present Segment Anything Model 2 (SAM 2), a foundation model towards solving promptable visual segmentation in images and videos. We build a data engine, which improves model and data via user interaction, to collect the largest video segmentation dataset to date. Our model is a simple transformer architecture with streaming memory for real-time video processing. SAM 2 trained on our data provides strong performance across a wide range of tasks. In video segmentation, we observe better accuracy, using 3x fewer interactions than prior approaches. In image segmentation, our model is more accurate and 6x faster than the Segment Anything Model (SAM). We believe that our data, model, and insights will serve as a significant milestone for video segmentation and related perception tasks. We are releasing our main model, dataset, as well as code for model training and our demo.

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.00714")

Code

Syntology Ran 28 of 49 code samples harvested from 6 repositories linked to this paper; 21 have no recorded run. Of those that ran: 2 ran · honoured contract; 4 ran · our draft was wrong; 22 ran with no contract checked.

By repository: official repository: 5 samples from 1 repository, 3 ran; community (archive-listed): 44 samples from 5 repositories, 25 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

facebookresearch/sam2 officialmentioned in papermentioned on GitHubpytorch report
TripleJoy/SAM2MOT mentioned on GitHubpytorchApache-2.0 report
bowang-lab/medsam2 mentioned on GitHubpytorchApache-2.0 report
dcnieho/segment-anything-2 mentioned on GitHubpytorch report
facebookresearch/segment-anything mentioned on GitHubpytorch report
idea-research/grounded-sam-2 mentioned on GitHubpytorch report
louisfinner/him2sam mentioned on GitHubpytorchApache-2.0 report
yangchris11/samurai mentioned 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

49 samples harvested; 28 ran; 2 honoured the contract we drafted; 21 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
4ran · our draft was wrong
22ran
21unverified

Licence: 0 of the 49 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 6 repositories linked to this paper, official or community; each sample names its own and says which. “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.

Attention facebookresearch/sam2/sam2/modeling/sam2_base.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · d505eb599e148d6a · report
PromptEncoder facebookresearch/sam2/sam2/modeling/sam2_base.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 57e7b89d7eb0f4a7 · report
TwoWayAttentionBlock facebookresearch/sam2/sam2/modeling/sam2_base.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · f7f9295761cf41cf · report
SAM2Base facebookresearch/sam2/sam2/modeling/sam2_base.py official repository unverified Apache-2.0 (permissive) · e7f8982afcc2eeb8 · report
TwoWayTransformer facebookresearch/sam2/sam2/modeling/sam2_base.py official repository unverified Apache-2.0 (permissive) · 1337a6ec7dc01de3 · report
Attention idea-research/grounded-sam-2/sam2/modeling/sam2_base.py community (archive-listed) ran · metamorphic tier: deterministic Apache-2.0 (permissive) · d47d7ea80c6eb2e1 · report
MLP idea-research/grounded-sam-2/sam2/modeling/sam2_base.py community (archive-listed) ran · metamorphic tier: deterministic Apache-2.0 (permissive) · b2caccbe8a2ad968 · report
MaskDecoder idea-research/grounded-sam-2/sam2/modeling/sam2_base.py community (archive-listed) ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 2ec3b3adb254bc95 · report
PositionEmbeddingRandom idea-research/grounded-sam-2/sam2/modeling/sam2_base.py community (archive-listed) ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 2d44a88dd1788d01 · report
PromptEncoder idea-research/grounded-sam-2/sam2/modeling/sam2_base.py community (archive-listed) ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 0d0005d3af5adb47 · report
TwoWayAttentionBlock idea-research/grounded-sam-2/sam2/modeling/sam2_base.py community (archive-listed) ran · metamorphic tier: deterministic Apache-2.0 (permissive) · ea24008f11c4c7ec · report
adjust_keep_rate louisfinner/him2sam/lib/utils/ce_utils.py community (archive-listed) ran Apache-2.0 (permissive) · 305742bafecf04f8 · report
all_gather louisfinner/him2sam/lib/utils/misc.py community (archive-listed) ran Apache-2.0 (permissive) · aa6da43d05cfaf65 · report
box_cxcywh_to_xyxy louisfinner/him2sam/lib/utils/box_ops.py community (archive-listed) ran · honoured contract fingerprinted Apache-2.0 (permissive) · e0a06ded5d4f6c3c · report
box_xywh_to_xyxy louisfinner/him2sam/lib/utils/box_ops.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · 40c655a7fe309e49 · report
box_xyxy_to_xywh louisfinner/him2sam/lib/utils/box_ops.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · b48a27604b9574e0 · report
collate_fn louisfinner/him2sam/lib/utils/misc.py community (archive-listed) ran Apache-2.0 (permissive) · 3f82133185c8bcb4 · report
compute_grids louisfinner/him2sam/lib/utils/heapmap_utils.py community (archive-listed) ran Apache-2.0 (permissive) · f0de0cc660ea9823 · report
generate_bbox_mask louisfinner/him2sam/lib/utils/ce_utils.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · d8da96a9ed23308f · report
generate_heatmap louisfinner/him2sam/lib/utils/heapmap_utils.py community (archive-listed) ran Apache-2.0 (permissive) · 02f602286c531143 · report
generate_mask_cond louisfinner/him2sam/lib/utils/ce_utils.py community (archive-listed) ran Apache-2.0 (permissive) · 90e571943800f79c · report
get_1d_sine_pe idea-research/grounded-sam-2/sam2/modeling/sam2_base.py community (archive-listed) ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · a6c3974188a5ffb0 · report
get_center3x3 louisfinner/him2sam/lib/utils/heapmap_utils.py community (archive-listed) ran Apache-2.0 (permissive) · 8ed1a71ee932713a · report
get_per_obj_mask bowang-lab/medsam2/medsam2_infer_video.py community (archive-listed) ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 259650ecd92aae93 · report
get_qkv louisfinner/him2sam/lib/utils/merge.py community (archive-listed) ran Apache-2.0 (permissive) · 2e6c35cccbde1c71 · report
load_ann_png bowang-lab/medsam2/medsam2_infer_video.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · fecc11868aafba36 · report
merge_template_search louisfinner/him2sam/lib/utils/merge.py community (archive-listed) ran Apache-2.0 (permissive) · c66db0b9eb9bb36a · report
put_per_obj_mask bowang-lab/medsam2/medsam2_infer_video.py community (archive-listed) ran · honoured contract Apache-2.0 (permissive) · 2e947f9cfdf99dc6 · report
reduce_dict louisfinner/him2sam/lib/utils/misc.py community (archive-listed) ran Apache-2.0 (permissive) · 05992505df9ef0cd · report
select_closest_cond_frames idea-research/grounded-sam-2/sam2/modeling/sam2_base.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · 4ee20f090e58c425 · report
SAM2Base idea-research/grounded-sam-2/sam2/modeling/sam2_base.py community (archive-listed) unverified Apache-2.0 (permissive) · 21359b77bae173ac · report
SAM2Base dcnieho/segment-anything-2/sam2/modeling/sam2_base.py community (archive-listed) unverified Apache-2.0 (permissive) · 784c0ac2dd86664c · report
TwoWayTransformer idea-research/grounded-sam-2/sam2/modeling/sam2_base.py community (archive-listed) unverified Apache-2.0 (permissive) · 9a8c4da19cecdb81 · report
build_efficienttam bowang-lab/medsam2/efficient_track_anything/build_efficienttam.py community (archive-listed) unverified Apache-2.0 (permissive) · a66342f2959074d2 · report
build_efficienttam_hf bowang-lab/medsam2/efficient_track_anything/build_efficienttam.py community (archive-listed) unverified Apache-2.0 (permissive) · 52aac67080d89311 · report
build_efficienttam_video_predictor bowang-lab/medsam2/efficient_track_anything/build_efficienttam.py community (archive-listed) unverified Apache-2.0 (permissive) · 1191ad63c426c255 · report
dice_loss bowang-lab/medsam2/training/loss_fns.py community (archive-listed) unverified Apache-2.0 (permissive) · e473e66fedc883c7 · report
dice_multi_class bowang-lab/medsam2/medsam2_infer_3D_CT.py community (archive-listed) unverified Apache-2.0 (permissive) · d982bf60cc066b9a · report
draw_mask ibaiGorordo/ONNX-SAM2-Segment-Anything/sam2/utils.py community (archive-listed) unverified MIT (permissive) · 8922173c3fa12488 · report
draw_masks ibaiGorordo/ONNX-SAM2-Segment-Anything/sam2/utils.py community (archive-listed) unverified MIT (permissive) · 23e01949c7f7b63f · report
getLargestCC bowang-lab/medsam2/medsam2_infer_3D_CT.py community (archive-listed) unverified Apache-2.0 (permissive) · 78368949ab5a1fd4 · report
get_center_from_recist bowang-lab/medsam2/eff_medsam2_infer_CT_lesion_npz_recist.py community (archive-listed) unverified Apache-2.0 (permissive) · a7768a633e703a5d · report
get_center_from_recist bowang-lab/medsam2/medsam2_infer_CT_lesion_npz_recist.py community (archive-listed) unverified Apache-2.0 (permissive) · 11b8b72a8eb095ec · report
iou_loss bowang-lab/medsam2/training/loss_fns.py community (archive-listed) unverified Apache-2.0 (permissive) · b8f501ca29e77f1a · report
resize_grayscale_to_rgb_and_resize bowang-lab/medsam2/eff_medsam2_infer_CT_lesion_npz_recist.py community (archive-listed) unverified Apache-2.0 (permissive) · 99b787e2d3339598 · report
sample_points_in_bbox_grid bowang-lab/medsam2/eff_medsam2_infer_CT_lesion_npz_recist.py community (archive-listed) unverified Apache-2.0 (permissive) · 621ef2b926968142 · report
sdp_kernel_context idea-research/grounded-sam-2/sam2/modeling/sam2_base.py community (archive-listed) unverified Apache-2.0 (permissive) · d5eb78117313126d · report
sigmoid_focal_loss bowang-lab/medsam2/training/loss_fns.py community (archive-listed) unverified Apache-2.0 (permissive) · 42fec6fdc1faf6f1 · report
slt_collate louisfinner/him2sam/lib/train/train_script.py community (archive-listed) unverified Apache-2.0 (permissive) · 954460c5c93e5dfe · report

Tasks

Image SegmentationRobot Manipulation GeneralizationSegmentationSemantic SegmentationSemi-Supervised Video Object SegmentationVideo Object SegmentationVideo SegmentationVideo Semantic SegmentationVisual Object Tracking

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Semi-Supervised Video Object Segmentation DAVIS 2017 (val) SAM2 J&F 90.7 #1 of 81 Archive leaderboard report
Semi-Supervised Video Object Segmentation DAVIS 2017 (val) SAM2 Params(M) 224.4 #1 of 81 Archive leaderboard report
Semi-Supervised Video Object Segmentation MOSE SAM2 J&F 77.9 #1 of 17 Archive leaderboard report
Video Object Segmentation M$^3$-VOS SAM 2 Average IOU 69.5 #4 of 4 Archive leaderboard report
Visual Object Tracking DiDi SAM2.1 Tracking quality 0.649 #3 of 11 Archive leaderboard report
Visual Object Tracking VOT2022 SAM2.1 EAO 0.692 #2 of 5 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

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