Skip to content

refactor: drop sam3_visual_track_params in favour of sam3_video_params - #35

Closed
PABannier wants to merge 1 commit into
cleanup/remove-test-apifrom
cleanup/merge-visual-track-params
Closed

PABannier wants to merge 1 commit into
cleanup/remove-test-apifrom
cleanup/merge-visual-track-params

Conversation

@PABannier

Copy link
Copy Markdown
Owner

sam3_visual_track_params duplicated 4 fields of sam3_video_params (assoc_iou_threshold, max_keep_alive, recondition_every, fill_hole_area), with the same defaults. sam3_create_visual_tracker immediately copied them field by field into a sam3_video_params, because that's what the tracker stores. Now it takes sam3_video_params directly and clears text_prompt, so a visual tracker still never runs PCS detection.

Public API change: sam3_create_visual_tracker(model, sam3_video_params). The README's sam3_create_visual_tracker(*model, {}) compiles unchanged. In-repo callers are updated:

  • examples/benchmark.cpp: changes the local's type.
  • examples/main_video.cpp: drops the mirror struct and the 4-line copy, and passes app.track_params directly.

Behaviour: the tracker used to ignore the caller's score_threshold, nms_threshold and hotstart_delay and apply the defaults (0.5 / 0.1 / 15). It now honours them. Every current caller passes the defaults for those fields (main_video never edits them), so nothing observable changes.

Stacked on #20 because tests/ on main still uses the old struct. Merge #20 first; GitHub will retarget this PR to main.

Verification: a parity tool calls sam3_create_visual_tracker(*model, {}), then compares add_instance plus a 3-frame propagation (and PVS) byte for byte with origin/main:

PARITY OK   edgetam_f16 gpu0
PARITY OK   edgetam_f16 gpu1
PARITY OK   sam2.1_hiera_tiny_q8_0 gpu0
PARITY OK   sam2.1_hiera_tiny_q8_0 gpu1

The full Release build, including sam3_benchmark and sam3_video, has no errors or new warnings.

Follow-up worth a look: recondition_every is never read anywhere in sam3.cpp; it's dead config in sam3_video_params too.

git diff --shortstat: 4 files changed, 8 insertions(+), 25 deletions(-).

Part of an over-engineering cleanup series.

🤖 Generated with Claude Code

https://claude.ai/code/session_01M2qLmQ9ag49hT61V6i9qAq

sam3_visual_track_params duplicated 4 fields of sam3_video_params, and
sam3_create_visual_tracker copied them one by one into a
sam3_video_params anyway. Take sam3_video_params directly and clear
text_prompt so the tracker never runs PCS detection.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M2qLmQ9ag49hT61V6i9qAq
@PABannier PABannier closed this Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant