Hiera configs and size detection from the weights, registry entries pinned to
commits with verified SHA-256, the loader picks the size by checksum. The GPU
encoder submits once per block so Large fits in memory, and uploads no longer
panic on a lost device. Reference tests run per size on the CPU and GPU.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
--clip FRAMES_DIR --truth MASKS_DIR runs the trackers on image sequences with true
mattes (strokes made from the truth; nothing is bundled or copied), tested end to end.
Trackers report the most memory their banks held (peakMB column).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Memory attention (1.8e-5 vs PyTorch) and the memory encoder (2.6e-6) as wgpu kernels,
convolution and layer-norm+GELU kernels, VideoModel::load_auto picks the GPU when
there is one (EFFECTCRAFT_SAM2_DEVICE overrides) and falls back to the CPU on any GPU
error; disable_gpu switches it off mid-clip. One process-wide device (several at once
crashed the Vulkan loader). A tracked frame: 4.3 s CPU, 0.7 s on the RX 7900 GRE.
Clips tracked on the GPU match Sam2VideoModel (worst logit error 0.0032).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Strided batched matmul with bias, GELU/ReLU and residual in the epilogue, layer
norm, softmax, window partition, pooling, patch embedding, RoPE and neck kernels
(WGSL, all tested against CPU definitions). GpuEncoder keeps activations on the
GPU and returns the 64x64 level and the decoder's skip features. On the RX 7900
GRE one frame encodes in 0.29 s (debug build) against 2.1 s on the CPU in release;
errors 6.8e-6 vs PyTorch, 1.2e-5 vs the CPU path.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
VideoTracker::set_budget (default 2 GiB of state, optional seconds per
propagate call) stops with Error::Budget; state_bytes reports what it holds.
Two runs of the same prompts give bit-identical masks.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Antialiased bilinear resize as PyTorch does it, the reference's mask-as-output
path (mask is the frame's output, the decoder makes the object pointer),
VideoTracker::prompt_mask, and mask-only prompts through the tracker interface.
Prompt frame logits exact, tracking forwards and backwards within 0.0019.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
TrackRequest takes a list of objects (each with its prompts on its frames) and
the tracker reports (object, frame, result); frame encodings are shared, objects
may start on different frames. VideoTracker::propagate_objects runs a subset.
Limits: 32 objects. Test: two discs, one prompted on frame 0 and one on frame 2.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ObjectTracker interface in the segment crate (prompts on some frames, the
clip tracked both ways, each frame streamed with confidence and an occluded
flag), implemented by SAM 2. MaskModel::tracker() is None for other models.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sam2Mask wraps the image path behind the Roto Brush's MaskModel interface
(cached frame encoding, bilinear mask resize). The engine loads the verified
weights natively (not on wasm). Checked with the real file: install, notice,
load, use by Roto Brush 3.0, deselect.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Click on frame 2 of a 7-frame clip with an occlusion, tracked forwards and
backwards: IoU 1.0000 on all 9 frame results, worst mask-logit error 0.0038,
object scores equal to 3 decimals.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Per-object memory banks, prompts on any frame, forward and backward
propagation with streaming results, cancellation, object pointers with
temporal encoding, pruning of memories no later frame can use, and checked
input handling. Hostile-input and cancel tests.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Self and cross attention with axial 2-D RoPE (keys tiled over memory frames,
object-pointer tokens left unrotated). Max abs error 2.6e-5.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Mask down-sampler, feature fuser and projection, sine position encoding,
occlusion embedding and bfloat16 rounding of stored memories. Max abs error
3.5e-6 on the memory features, 6e-8 on the position encoding.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A click on the synthetic image: mask logits within 1.1e-4 (range 11.6), IoU
head 1e-6, object score 2e-5, prompt embeddings 1e-7.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Weights loader with shape/finite validation (S2.10), patch embed, bicubic
positional embedding, window/global attention, query pooling. Reference test
(skips without weights): max abs error 2.6e-5 over all 12 blocks.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>