사무라이(SAMURAI/SAM)가 객체 형태 자체를 파란색 마스크로 그려주는 것은 픽셀 단위의 세그멘테이션(mask prediction) 방식으로, 사전에 정의된 앵커 박스를 사용하는 앵커 기반(Anchor-Based) 방식이 아닙니다.
1. 앵커 박스 vs 세그멘테이션 마스크
- 앵커 박스(Anchor Box):
객체 검출(Object Detection)에서 다양한 크기·비율의 사전 정의된 박스를 그리드 셀 위치마다 배치하고, 각 앵커에 대한 오프셋(offset)과 클래스 확률을 예측하는 방식입니다. - 세그멘테이션 마스크(Segmentation Mask):
픽셀 단위로 객체 여부를 예측하여, 객체 영역을 폴리곤 혹은 이진 바이너리 형태의 마스크로 출력합니다.
그림: 앵커 박스(왼쪽) vs. 세그멘테이션 마스크(오른쪽) 비교 예시[1]
2. SAMURAI/SAM의 동작 원리
- 프롬프트(prompt) 입력
- 점(point), 사각형(box), 텍스트 등 다양한 형태의 프롬프트를 받아들임.
- 이미지·프롬프트 인코딩
- 이미지 인코더(Image Encoder)로 시각 피처를 추출
- 프롬프트 인코더(Prompt Encoder)로 위치 정보 등을 임베딩
- 마스크 디코더(Mask Decoder)
- 인코딩된 피처와 프롬프트 임베딩을 결합하여, 픽셀 단위의 객체 마스크를 직접 예측
- 사전에 정의된 박스(anchors)를 사용하지 않음[1]
이 과정에서 생성된 마스크가 파란색 등 원하는 색으로 시각화되는 것이며, 이는 바운딩 박스 기반 물체 검출과는 전혀 다른 세그멘테이션 결과입니다.
3. 앵커 없이 작동하는 이유
- 하나의 마스크 토큰만으로 다양한 형태의 객체를 잘 분리
- 앵커 매칭·하이퍼파라미터 튜닝 불필요
- 프롬프트 형태에 따라 즉시 마스크 예측 → 제로샷(zero-shot) 세그멘테이션 가능
따라서 “사무라이는 파란색 마스크를 그려주는데, 이건 앵커 박스 방식이 아닌가요?”라는 질문에 대한 답은 “네, 앵커 박스를 쓰지 않는 픽셀 단위 세그멘테이션 방식입니다.”입니다.
출처
[1] Segment Anything https://openaccess.thecvf.com/content/ICCV2023/papers/Kirillov_Segment_Anything_ICCV_2023_paper.pdf
[2] SAMURAI Robust Object Tracking without ANY TRAINING! – YouTube https://www.youtube.com/watch?v=pHq9eMVdvcA
[3] [논문 리뷰] SAMURAI: Shape-Aware Multimodal Retrieval for 3D … https://www.themoonlight.io/ko/review/samurai-shape-aware-multimodal-retrieval-for-3d-object-identification
[4] API 개발 가이드 https://aiopen.etri.re.kr/guide/od
[5] SAMURAI: Adapting Segment Anything Model for Zero-Shot Visual … https://yangchris11.github.io/samurai/
[6] Semantic Image Segmentation with colored masks https://stackoverflow.com/questions/58190815/semantic-image-segmentation-with-colored-masks
[7] 객체 감지 및 추적 | ML Kit | Google for Developers https://developers.google.com/ml-kit/vision/object-detection?hl=ko&rut=f80bb77378745208c12288ee4b43d1fe5b5f704dde195649178ac8a0d391d68f
[8] SAMURAI: Adapting Segment Anything Model for Zero-Shot Visual … https://arxiv.org/html/2411.11922v1
[9] Segment Anything in High Quality https://proceedings.neurips.cc/paper_files/paper/2023/file/5f828e38160f31935cfe9f67503ad17c-Paper-Conference.pdf
[10] GitHub – IDEA-Research/Grounded-Segment-Anything https://github.com/IDEA-Research/Grounded-Segment-Anything
[11] GitHub – gulcihanglmz/segment-anything-model-SAM-with-bounding-boxes: ✨This script performs semantic segmentation on images using bounding box annotations from XML files and saves the results. https://github.com/gulcihanglmz/segment-anything-model-SAM-with-bounding-boxes
[12] [논문리뷰] Fast Segment Anything (FastSAM) – 전생했더니 인공지능 … https://kimjy99.github.io/%EB%85%BC%EB%AC%B8%EB%A6%AC%EB%B7%B0/fastsam/
[13] [PDF] Segment and Recognize Anything at Any Granularity https://www.ecva.net/papers/eccv_2024/papers_ECCV/papers/06495.pdf
[14] [논문 리뷰] Fast Segment Anything | Fast SAM | SAM의 경량화 https://mvje.tistory.com/152
[15] HACARUS Tech Blog: Segment Anything Tutorial – HACARUS INC. https://hacarus.com/ai-lab/sam-20240620/
[16] Meta AI의 SAM(Segment Anything Model) 리뷰 – cherish-j devlog https://cherish-j.tistory.com/142
[17] Semantic-SAM: Segment and Recognize Anything at Any Granularity https://arxiv.org/html/2307.04767
[18] Performance Evaluation of Segment Anything Model with Variational … https://arxiv.org/html/2404.12285v1
[19] [Segment Anything] Zero-shot segmentation model https://ai-scholar.tech/en/articles/segmentation%2Fsegment-anything
[20] GitHub – luv-bansal/Segment-Anything-Model-SAM- https://github.com/luv-bansal/Segment-Anything-Model-SAM-
[21] SAM (Segment Anything Model) https://docs.ultralytics.com/models/sam/
[22] Segment Anything | Meta AI https://segment-anything.com
[23] SAMURAI : 동적 환경에서의 객체 추적 – AI 탐구노트 – 티스토리 https://42morrow.tistory.com/entry/SAMURAI-%EB%8F%99%EC%A0%81-%ED%99%98%EA%B2%BD%EC%97%90%EC%84%9C%EC%9D%98-%EA%B0%9D%EC%B2%B4-%EC%B6%94%EC%A0%81
[24] SAMURAI: Adapting Segment Anything Model for Zero-Shot Visual … https://github.com/yangchris11/samurai
[25] Anchor-Free Object Detection – Ultralytics https://www.ultralytics.com/glossary/anchor-free-detectors
[26] The Segment Anything Model (SAM) for remote sensing applications https://www.sciencedirect.com/science/article/pii/S1569843223003643
답글 남기기