TT Lab
Blog

한국어 English 日本語 中文

Get started
Blog

Blog

SAM 2 and EfficientTAM: Tracking Objects in Video with Memory Attention and Making It Lightweight

Status: Draft (2026-10-13), partial measurements added (2026-10-15). The speed and accuracy of SAM 2.1 tiny cite measurements from Part 3 of the TT Score Model Anatomy (2026-10-11–12, during a period of shared server GPUs and temporary CPU pods). The memory reduction example was run directly on a laptop CPU (code/10_memory_pool.py, a few seconds). Added on 2026-10-15: For EfficientTAM, which previously lacked measurements, Section 6 cites values measured under the same conditions as SAM 2.1 tiny for an automatic table tennis table detection task. The actual smoothness of the memory map remains unmeasured. Paper figures were transcribed from the original text along with their conditions, and hardware is specified by tier. Writing Rule: Measured data is the baseline, and unmeasured items are marked as "Unmeasured".

Table of Contents

1. From Images to Video: What Else Is Needed

Part 9's SAM segments a single image. To achieve "segment the object pointed to in the first frame all the way to the end" in a video, two more things are needed:

  1. Memory: What the object looked like in previous frames. The model must recognize that it is the same object even if it rotates or is temporarily occluded.
  2. Speed: Running a heavy encoder from scratch for every frame is slow.

SAM 2 by Ravi et al. solves both problems by attaching memoryto SAM's architecture. Because an image is treated as a "single-frame video," the same model segments both images and videos.

2. Architecture: Remembering While Streaming

SAM 2: 지난 프레임의 기억을 보고 이번 프레임을 칠한다 t−4 t−3 t−2 t−1 t ★ ★ 프롬프트를 준 프레임과 최근 프레임 몇 장의 기억을 둔다 이미지 인코더(Hiera) 메모리 뱅크 최근 N장(기본 6) + 프롬프트 프레임 + 물체 포인터 메모리 어텐션 × 4 셀프 → 메모리로 교차 마스크 디코더 → 마스크 메모리 인코더: 이번 마스크를 기억으로 바꿔 넣는다 EfficientTAM 의 줄이기: 기억의 공간 토큰을 2×2 로 평균 → 키·값 4분의 1 이웃 칸의 기억은 서로 비슷하다(국소적 매끄러움)는 가정. 물체 포인터 토큰은 줄이지 않는다.
Image: The flow of SAM 2 where a frame passes through the image encoder, references memories in the memory bank via memory attention, and the output mask from the mask decoder feeds back into memory. Below is EfficientTAM's 2x2 reduction

Frames arrive one by one in sequence (streaming). Here is what happens in each frame:

  1. Image Encoder: MAE-pretrained Hiera(hierarchical transformer from Part 7, Section 6) turns the frame into features. This runs once per frame.
  2. Memory Attention: The current frame's features first attend to themselves (self-attention) and then to the memories in the memory bank (cross-attention). There are typically 4 such blocks.
  3. Mask Decoder: A decoder identical to SAM generates the mask. If a user provided a click for the current frame, it is also used as a prompt. A separate prediction head determines whetherthe object is visible in this frame, allowing it to output "none" for completely occluded frames.
  4. Memory Encoder: Downsamples the newly generated mask, adds it to the current frame's features, and blends them with lightweight convolutions to create the memory that "the object looked like this in this frame."
  5. Memory Bank: Maintains separate queues for recent frame memories (typically 6 frames) and user-prompted frame memories (FIFO). It also stores object pointersextracted from the mask decoder's output tokens (256 dimensions split into four 64-dimension tokens). While the spatial map answers "where and how," the pointer summarizes "what the object is."

Intuitively, this means "find the object in the current frame by referencing both how it appeared in the last few frames and what it looked like in the scene where the user first pointed at it." Keeping the memory of the user-indicated frame for a long time is a crucial design choice. Relying solely on recent memories easily leads to drift, where slightly erroneous masks become memories that make subsequent frames even more inaccurate. The user-verified memory acts as an anchor.

3. Data and Metrics

SA-V Data: 50,900 videos, 642,600 masklets (per-frame mask bundles of an object in a video; 190,900 human + 451,700 automatic), and 35.5 million masks. Similar to SAM's data engine (Part 9), this dataset was built by running a model-segmentation and human-correction loop on videos.

Item Value (Paper) Condition
Video Segmentation Interaction 3x fewer clicks than previous methods with higher accuracy Paper Summary Image Segmentation
More accurate and 6x faster than SAM (130.1 vs 21.7 FPS)Single datacenter GPU, bfloat16, image encoder compiled, batch size 10 Video Speed
Hiera-B+ 43.8 FPS, Hiera-L 30.2 FPS Same GPU, batch size 1 Training
256 datacenter GPUs, 108 hours Model Card This is the official table of

SAM 2.1 checkpoints released in September 2024 (single datacenter GPU, all components compiled. Measurement environment differs from the paper). Size

Parameters FPS SA-V Test J&F MOSE Validation J&F LVOS v2 J&F tiny
38.9 million small 91.2 76.5 71.8 77.3
46 million base+ 84.8 76.6 73.5 78.3
80.8 million large 64.1 78.2 73.7 78.2
224.4 million J&F is the average of mask region overlap (J) and boundary accuracy (F). Notably, even when increasing the model size by nearly 6x, the difference in SA-V is only 3 points. Code and checkpoints are under Apache-2.0. 39.5 79.5 74.6 80.6

Our Measurements: SAM 2.1 tiny

TT Score experimented with the smallest tiny model for table tennis table segmentation (TT Score Model Anatomy Part 3).

Condition

Value Server GPU, shared with other workloads (2026-10-11)
Image encoding 40ms, prompt prediction 26ms, single-object video tracking 36–38ms/frame, GPU memory 0.68–0.96GB Temporary CPU pod (2026-10-12)
Median 1.14 seconds per frame Table tennis table corners (12 actual match clips, 5-frame median)
Median difference from dataset mask 4.7px, 90th percentile 11.2px The official table's 91.2 FPS (approx. 11ms per frame) and our 36–38ms were measured under different conditions. The official table values reflect a dedicated GPU with all components compiled, whereas we shared the GPU with other tasks. This illustrates why conditions must always be cited alongside numbers, even for the "same model".

4. EfficientTAM: Reducing Memory for Lighter Weight

EfficientTAM by Xiong et al. aims to make SAM 2 lightweight enough to run on mobile phones. Two main changes were made:

Flat ViT Encoder.

  1. Instead of the hierarchical Hiera, it uses a smaller single-resolution ViT (Tiny/Small, patch size 16), initialized via EfficientSAM's SAMI pretraining. Coarse Memory Cross-Attention.
  2. Spatial tokens (keys and values) in memory are averaged over 2x2 windows to reduce them to one-fourth before attention is applied. Object pointer tokens are not reduced.

The rationale for item 2 is local smoothness. Since features of neighboring cells in a memory map are similar, replacing four cells with their average does not drastically change the attention output. The paper showed that in one example, the relative error compared to full attention was 0.03 (Figure 3, single example), and reported that further reducing it to 4x4 drops accuracy by about 1 point while yielding minimal speed gains.

Hands-On: Is Smoothness Really Enough?

We tested this assumption directly. Memory = 32x32 cells x 4 frames x 64 dimensions, 1,024 queries. We measured how much the attention output changes when keys and values are averaged in 2x2 blocks for two types of memory (measured values, laptop CPU, median of 7 runs).

Memory Type Key Count Relative Error Time
Smooth (low-frequency field with similar neighbors) 4,096 → 1,024 0.050 29.2 → 8.4ms
Coarse (random per cell) 4,096 → 1,024 0.753 30.9 → 8.3ms

Execution time decreased to about one-fourth, proportional to the key count. The error was small only when the memory was smooth. EfficientTAM's reduction is not a free lunch; it relies on the assumption that "video features are similar among neighbors", and is accurate only to the extent that this assumption holds. How smooth actual features are varies by model and scene, and we did not measure this using actual memory maps (Unmeasured).

Paper Figures and Points to Note When Reading

Model SA-V Test J&F Parameters Datacenter GPU FPS Mobile Phone (per frame)
SAM 2 (comparison target) 74.7 81 million 43.8 —
EfficientTAM-S 74.5 34 million 85.0 1,010.8ms
EfficientTAM-S/2 74.0 34 million 109.4 450ms
EfficientTAM-Ti 70.7 18 million 96.2 840.5ms
EfficientTAM-Ti/2 70.8 18 million 109.4 261.4ms

(Paper Table 1, 1024x1024 input. "/2" denotes the version where memory is reduced via 2x2. Mobile phone refers to a 2023 high-end device.)

A close look at the original text reveals discrepancies in two places.

Copying only numbers from a paper summary omits such conditions, which is why examining the original tables directly is necessary. Code and checkpoints are under Apache-2.0, and conference publication status has not been verified (arXiv version).

5. Limitations

6. Connection to Our Project

The next post is about SAM 2, which calls objects by textinstead of clicks.

TT Word. Aggregating memories into 2×2 is fine only when neighboring cells resemble each other. When we aggregated arbitrary memories, the answer changed by as much as 75%.

References

Sign in to like

Comments

No comments yet.

Sign in to leave a comment