# SAM 2: Segment Anything in Images and Videos

SAM 2: 프롬프트로 영상 속 객체를 따라가며 분할

Nikhila Ravi, Valentin Gabeur, Yuan-Ting Hu, Ronghang Hu, Chaitanya Ryali, Tengyu Ma 외 12명 · arXiv · 2024년 8월 1일

- **연구 문제** 기존 Segment Anything은 정지 이미지용이라, 영상에서 객체가 움직이고 가려지면 프레임마다 마스크를 따로 만드는 방식으로는 충분하지 않았습니다.
- **연구 방법** SAM 2는 프레임을 하나씩 순서대로 처리하며, 앞 프레임의 메모리를 현재 프레임에 참고해 프롬프트로 고른 객체의 마스크를 영상 전체로 전파합니다.
- **주요 결과** 9개 영상 데이터셋의 상호작용 평가에서 SAM+XMem++, SAM+Cutie보다 높은 J&F를 보였고, 이미지 분할의 1-click mIoU도 SAM보다 높았습니다.

## 이미지와 영상을 함께 다루는 분할의 어려움

SAM 2는 이미지 분할을 영상으로 확장하는 문제를 다룹니다. 기존 Segment Anything은 정지 이미지에서 프롬프트에 맞는 마스크를 만들었지만, 실제 영상에서는 객체가 움직이고 변형되며 가려지고 조명이 바뀝니다. 영상은 카메라 움직임과 흐림, 낮은 해상도 때문에 품질도 떨어집니다. 따라서 영상 분할은 프레임마다 독립적으로 마스크를 만드는 것만으로는 충분하지 않습니다.

논문은 이를 Promptable Visual Segmentation 과제로 정식화합니다. 이 과제에서는 임의의 프레임에 점, 상자, 마스크 프롬프트를 줄 수 있고, 모델은 그 객체의 마스크렛을 전체 영상에 전파합니다. 이미지는 단일 프레임 영상으로 취급되므로 하나의 모델로 두 영역을 함께 다룰 수 있습니다.

## 스트리밍 메모리를 갖춘 구조

SAM 2는 프레임을 한 번에 하나씩 처리하는 스트리밍 구조를 사용합니다. Hiera 이미지 인코더는 각 프레임에 대해 한 번만 실행되어 특징을 만들고, memory attention은 이 현재 프레임 특징을 과거 프레임의 메모리, 객체 포인터, 새 프롬프트에 조건화합니다. 메모리는 memory encoder가 예측 마스크를 다운샘플링해 이미지 인코더의 임베딩과 합쳐 만들며, memory bank에 FIFO 큐로 저장됩니다.

프롬프트 인코더와 mask decoder는 SAM의 설계를 대부분 따릅니다. 모호한 한 번의 클릭에는 여러 마스크를 예측하고, 영상에서는 후속 프롬프트가 없으면 현재 프레임에서 예측 IoU가 가장 높은 마스크를 전파합니다. 객체가 없을 수 있는 PVS 과제를 위해 객체 존재 여부를 예측하는 head가 추가되었습니다. 이미지만 입력되면 메모리가 비어 있어 모델이 SAM처럼 동작합니다.

## 데이터 엔진과 SA-V 데이터셋

SAM 2의 학습 데이터는 모델을 루프에 넣은 데이터 엔진으로 만들어졌습니다. 1단계는 프레임마다 SAM으로 마스크를 만드는 방식이고, 2단계는 마스크 프롬프트만 받는 SAM 2 Mask로 마스크를 전파합니다. 3단계는 점과 마스크 프롬프트를 모두 받는 SAM 2를 주석 루프에 넣습니다. 표 1의 통제 실험에서는 프레임당 주석 시간이 37.8초, 7.4초, 4.5초로 줄었고, 3단계는 1단계 대비 약 8.4배 빠르다고 보고됩니다.

자동 마스크렛은 첫 프레임의 격자 점에 SAM 2를 적용해 만들고 검증 단계를 거쳐 추가됩니다. 검증 및 분할 평가에서는 수동 주석과 자동 주석의 역할을 구분해야 합니다.

## 비디오 상호작용 분할과 VOS 결과

상호작용 평가에서 SAM 2는 9개 밀집 주석 제로샷 비디오 데이터셋에서 3-click 프롬프트로 평가되었습니다. 오프라인과 온라인 두 설정 모두에서 SAM 2는 SAM+XMem++와 SAM+Cutie보다 높은 평균 J&F를 보였고, 원문은 더 적은 상호작용으로 더 나은 정확도를 얻는다고 보고합니다.

첫 프레임의 ground-truth 마스크를 입력하는 반지도 VOS 설정에서는 SAM 2(Hiera-B+)가 MOSE 검증 세트에서 J&F 76.6을 기록했습니다. 이 점수는 해당 설정의 결과이며, 상호작용 평가 점수와 같은 프로토콜로 묶을 수 없습니다.

## 이미지 분할 평가와 한계

이미지 분할에서는 SA 과제의 23개 데이터셋에 대해 1-click mIoU를 비교했습니다. SAM 2는 58.9를 기록해 SAM의 58.1보다 높았으며, 원문은 같은 조건에서 SAM보다 6배 빠르다고 보고합니다. 이 속도는 단일 A100 GPU 기준입니다. 자체 데이터로 학습한 변형은 더 높은 평균을 보였습니다.

한계도 분명합니다. 장면 전환, 혼잡한 장면, 긴 가림 이후에는 객체를 놓치거나 혼동할 수 있으며, 얇거나 빠르게 움직이는 객체는 정확히 추적하기 어렵습니다. 따라서 이 결과는 주어진 데이터셋과 평가 프로토콜에서 얻은 것입니다.

## 논문 정보

- **저자**: 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
- **학회·저널**: arXiv · 프리프린트
- **최초 공개일**: 2024년 8월 1일
- **등록일**: 2026년 11월 12일
- **수정일**: 2024년 10월 28일
- **버전**: v2
- **arXiv**: 2408.00714
- **분류**: cs.CV · cs.AI · cs.LG
- **원문 이용 조건**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **제공 범위**: 논문 정보, 해설

[논문 원문 ↗](https://arxiv.org/abs/2408.00714v2) · [원문 PDF ↗](https://arxiv.org/pdf/2408.00714v2)

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

## 원문 인용

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 (2024). SAM 2: Segment Anything in Images and Videos. arXiv:2408.00714v2. https://arxiv.org/abs/2408.00714v2

**BibTeX**

```
@misc{ravi2024segment,
  title = {{SAM 2: Segment Anything in Images and Videos}},
  author = {Nikhila Ravi and Valentin Gabeur and Yuan-Ting Hu and Ronghang Hu and Chaitanya Ryali and Tengyu Ma and Haitham Khedr and Roman Rädle and Chloe Rolland and Laura Gustafson and Eric Mintun and Junting Pan and Kalyan Vasudev Alwala and Nicolas Carion and Chao-Yuan Wu and Ross Girshick and Piotr Dollár and Christoph Feichtenhofer},
  year = {2024},
  eprint = {2408.00714},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.00714v2}
}
```

## 이 논문의 용어

- [mIoU](https://refivu.com/terms/901dcc5384c2-miou)
- [memory bank](https://refivu.com/terms/130f857ce3f1-memory-bank)
- [data engine](https://refivu.com/terms/87b963207b71-data-engine)
- [mask decoder](https://refivu.com/terms/3976b4ac4671-mask-decoder)
- [SAM 2](https://refivu.com/terms/be8007225af6-sam-2)
- [Segment Anything Model](https://refivu.com/terms/21c36db01b7b-segment-anything-model)
- [memory encoder](https://refivu.com/terms/546592998f30-memory-encoder)
- [SA-1B](https://refivu.com/terms/bf46eff02b6e-sa-1b)
- [video object segmentation](https://refivu.com/terms/740775fcd758-video-object-segmentation)

## 다른 논문 해설

- [Masked-attention Mask Transformer for Universal Image Segmentation](https://refivu.com/papers/50cd7b17-dd9f-4dc4-9cef-f0a5bc0e4924-masked-attention-mask-transformer-for-universal-image.md)
- [Transformers in Vision: A Survey](https://refivu.com/papers/5380a1d5-fae3-41ad-ab72-e650e9db12fe-transformers-in-vision-a-survey.md)
- [Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour](https://refivu.com/papers/c430ecf3-8156-45a7-a3f7-eafc308c0d49-accurate-large-minibatch-sgd-training-imagenet-in-1.md)
- [Image Segmentation Using Deep Learning: A Survey](https://refivu.com/papers/c5b4071c-1e13-4bda-97cd-37556fea547e-image-segmentation-using-deep-learning-a-survey.md)
- [Residual Attention Network for Image Classification](https://refivu.com/papers/a2dac1b2-ffde-41af-9f9c-c9914f383632-residual-attention-network-for-image-classification.md)
- [DeCAF: A Deep Convolutional Activation Feature for Generic Visual Recognition](https://refivu.com/papers/b018056b-58d2-42cc-9184-ed3588d7abd4-decaf-a-deep-convolutional-activation-feature-for-generic.md)
- [A Broad-Coverage Challenge Corpus for Sentence Understanding through Inference](https://refivu.com/papers/6a9a87c0-1034-4d6f-8def-43a3279e4725-a-broad-coverage-challenge-corpus-for-sentence-understanding.md)
- [Supervised Contrastive Learning](https://refivu.com/papers/a5818cfe-00fa-4e85-a38e-cdce6aa6cad5-supervised-contrastive-learning.md)
- [The Future of Digital Health with Federated Learning](https://refivu.com/papers/1562dfe5-7a60-4996-ad5c-7fe34a7d94e7-the-future-of-digital-health-with-federated-learning.md)
- [Past, Present, and Future of Simultaneous Localization And Mapping: Towards the Robust-Perception Age](https://refivu.com/papers/52381e81-8cdd-4551-89ee-d6c7630fb938-past-present-and-future-of-simultaneous-localization-and.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/44b54691-126e-4def-9b6b-d659caa1f50d-sam-2-segment-anything-in-images-and-videos)
