SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.16268 · 2024

SAM2Long: Enhancing SAM 2 for Long Video Segmentation with a Training-Free Memory Tree

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 10 functions out of this paper's own repositories and ran 5 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
mark12ding/sam2long canonical 5 of 10
FunctionStatusWhere it lives
compute_axial_cis Ran mark12ding/sam2long/sam2/modeling/position_encoding.py
pointer only (licence: NONE) · get_code("7ceaad42da42edd5")
get_1d_sine_pe Ran mark12ding/sam2long/sam2/modeling/sam2_utils.py
pointer only (licence: NONE) · get_code("a6c3974188a5ffb0")
init_t_xy Ran mark12ding/sam2long/sam2/modeling/position_encoding.py
pointer only (licence: NONE) · get_code("bb060d29525f90eb")
reshape_for_broadcast Ran mark12ding/sam2long/sam2/modeling/position_encoding.py
pointer only (licence: NONE) · get_code("f8f09f78b474ee7c")
select_closest_cond_frames Ran mark12ding/sam2long/sam2/modeling/sam2_utils.py
pointer only (licence: NONE) · get_code("4ee20f090e58c425")
build_sam2 Not yet run mark12ding/sam2long/sam2/build_sam.py
pointer only (licence: NONE) · get_code("f9850c1d4acdbb5a")
build_sam2_hf Not yet run mark12ding/sam2long/sam2/build_sam.py
pointer only (licence: NONE) · get_code("de8c2a625f263855")
build_sam2_video_predictor Not yet run mark12ding/sam2long/sam2/build_sam.py
pointer only (licence: NONE) · get_code("c1b9e144954a57e5")
do_pool Not yet run mark12ding/sam2long/sam2/modeling/backbones/hieradet.py
pointer only (licence: NOASSERTION) · get_code("d3df9ada3e05fa55")
get_activation_fn Not yet run mark12ding/sam2long/sam2/modeling/sam2_utils.py
pointer only (licence: NONE) · get_code("f2e72d81f39d65cd")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The Segment Anything Model 2 (SAM 2) has emerged as a powerful foundation model for object segmentation in both images and videos, paving the way for various downstream video applications. The crucial design of SAM 2 for video segmentation is its memory module, which prompts object-aware memories from previous frames for current frame prediction. However, its greedy-selection memory design suffers from the "error accumulation" problem, where an errored or missed mask will cascade and influence the segmentation of the subsequent frames, which limits the performance of SAM 2 toward complex long-term videos. To this end, we introduce SAM2Long, an improved training-free video object segmentation strategy, which considers the segmentation uncertainty within each frame and chooses the video-level optimal results from multiple segmentation pathways in a constrained tree search manner. In practice, we maintain a fixed number of segmentation pathways throughout the video. For each frame, multiple masks are proposed based on the existing pathways, creating various candidate branches. We then select the same fixed number of branches with higher cumulative scores as the new pathways for the next frame. After processing the final frame, the pathway with the highest cumulative score is chosen as the final segmentation result. Benefiting from its heuristic search design, SAM2Long is robust toward occlusions and object reappearances, and can effectively segment and track objects for complex long-term videos. Notably, SAM2Long achieves an average improvement of 3.0 points across all 24 head-to-head comparisons, with gains of up to 5.3 points in J&F on long-term video object segmentation benchmarks such as SA-V and LVOS. The code is released at https://github.com/Mark12Ding/SAM2Long.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2410.16268")
get_code_for_paper("2410.16268")
have("2410.16268")

Connect an agent — have() is free.