Transformers
摘要
The transformer architecture has transformed natural language processing (NLP) and is now making strides in computer vision. This chapter explores its core components, including self-attention and encoder-decoder structures, which enable parallel processing and long-range dependency modeling without recurrent networks. In visual tasks, the vision transformer (ViT) treats image patches as input tokens, achieving strong performance with large-scale training. The Swin transformer enhances this by introducing a hierarchical, multi-scale approach, mimicking CNNs for tasks like classification and segmentation. These advancements demonstrate the transformer’s versatility in bridging NLP and computer vision, offering new research and application opportunities.