트랜스포머는 NLP에나 쓰는 기술 아닌가요? 컴퓨터 비전 연구자들이 불과 몇 년 전까지 입버릇처럼 하던 말이다. ViT(Vision Transformer)가 등장하면서 그 통념이 흔들리기 시작했지만,이미지의 다양한 스케일 처리와 픽셀 해상도 문제는 여전히 발목을 잡았다. 언어 모델처럼 고정 패치 임베딩만으로는 멀티스케일 비전 태스크를 감당하기 어려웠다.
arXiv에 공개되어 이후 컴퓨터 비전 분야 표준으로 자리잡은 Swin Transformer는 이 문제를 이동 윈도우 방식으로 해결했다. Microsoft Research 팀이 제안한 이 계층적 비전 트랜스포머는 범용 컴퓨터 비전 백본으로 설계됐다.
핵심 아이디어는 간단하다. 자기 어텐션 연산을 겹치지 않는 로컬 윈도우 내로 제한함으로써 계산 복잡도를 이미지 크기에 선형 비례하도록 만들었다. 동시에,레이어마다 윈도우를 이동시켜 인접 윈도우 간 크로스-윈도우 연결을 허용했다. 이 방식이 계층적 특징 맵을 자연스럽게 생성해 다양한 스케일의 시각적 객체를 처리할 수 있게 한다.
성능 수치가 모든 것을 말해준다. ImageNet-1K에서 87.3% top-1 정확도, COCO test-dev에서 58.7 box AP / 51.1 mask AP, ADE20K에서 53.5 mIoU의 시맨틱 분할 성능을 달성했다. COCO에서는 이전 최고 성능 대비 +2.7 box AP, +2.6 mask AP를, ADE20K에서는 +3.2 mIoU를 기록해 단순 성능 개선이 아닌 패러다임 전환 수준이었다.
한계도 있다. 윈도우 기반 어텐션은 전역 의존성 포착이 완전하지 않다는 이론적 제약이 있으며, 고해상도 이미지에서는 메모리 부담이 상당하다. 이후 Swin v2, Focal Transformer 등 후속 연구들이 이 제약을 개선해나가고 있다.
객체 탐지, 인스턴스 분할, 시맨틱 분할 파이프라인에서 ResNet/ResNeXt를 교체할 백본을 찾고 있다면 Swin Transformer가 최선의 출발점이다. 공식 구현체와 사전학습 가중치가 GitHub(microsoft/Swin-Transformer)에 공개되어 있어 즉시 파인튜닝에 활용할 수 있다.
📖 *Swin Transformer: Hierarchical Vision Transformer using Shifted Windows* |
논문 원문
※ 이 기사는 학술 논문을 바탕으로 작성되었습니다.
Transformers are a language thing. That assumption held until Vision Transformers (ViT) arrived—but even then, the core challenges persisted: visual entities appear at wildly varying scales, image resolution dwarfs anything in NLP, and fixed-patch embeddings cannot naturally produce the multi-scale feature hierarchies that dense prediction tasks like detection and segmentation demand.
Swin Transformer, introduced in a 2021 arXiv paper from Microsoft Research, solves these problems with a single elegant constraint: limit self-attention to non-overlapping local windows, then shift those windows between layers to enable cross-window connections. The result is a hierarchical vision backbone with linear computational complexity relative to image size—a property that finally makes transformers practical as general-purpose vision backbones.
The architecture works by computing self-attention within fixed local windows (rather than across the entire image), which keeps the compute budget manageable. Between layers, the windows shift by half their size, creating connections between previously isolated windows without a full attention pass. This naturally produces hierarchical feature maps at multiple resolutions, making Swin Transformer a direct drop-in for CNN-based detection and segmentation pipelines that depend on feature pyramid networks.
The benchmark results tell the rest of the story. On ImageNet-1K, Swin Transformer achieves 87.3% top-1 accuracy. On COCO test-dev, it reaches 58.7 box AP and 51.1 mask AP for object detection and instance segmentation—surpassing the previous state of the art by +2.7 box AP and +2.6 mask AP. ADE20K semantic segmentation lands at 53.5 mIoU, a +3.2 improvement over prior leaders. These are not incremental gains; they signaled a genuine regime change in how the field thinks about vision backbones.
The honest trade-off: window-based attention imposes a theoretical upper bound on global context capture. Very long-range dependencies can fall through the cracks unless addressed through window size tuning or hybrid designs. Memory costs also remain non-trivial for very high-resolution inputs. Swin v2 and subsequent variants address some of these constraints.
For practitioners: if you are building an object detection, instance segmentation, or semantic segmentation pipeline and still running ResNet or ResNeXt as your backbone, Swin Transformer is the most validated upgrade path available. The official implementation and pretrained weights are open-sourced at github.com/microsoft/Swin-Transformer—fine-tuning on domain-specific data is well-documented and broadly supported by major frameworks.
📖 *Swin Transformer: Hierarchical Vision Transformer using Shifted Windows* |
Source Paper
※ This article is based on an academic paper.