[Paper Review] StyleSwin: Transformer-based GAN for High-resolution Image Generation
StyleSwin proposes a transformer-based GAN for high-resolution image generation by integrating Swin transformers into a style-based generator with double attention and sinusoidal positional encoding to enhance receptive field and spatial coherence. It achieves state-of-the-art FID scores of 4.43 on CelebA-HQ 1024×1024 and 5.07 on FFHQ 1024×1024, outperforming StyleGAN without complex training strategies.
Despite the tantalizing success in a broad of vision tasks, transformers have not yet demonstrated on-par ability as ConvNets in high-resolution image generative modeling. In this paper, we seek to explore using pure transformers to build a generative adversarial network for high-resolution image synthesis. To this end, we believe that local attention is crucial to strike the balance between computational efficiency and modeling capacity. Hence, the proposed generator adopts Swin transformer in a style-based architecture. To achieve a larger receptive field, we propose double attention which simultaneously leverages the context of the local and the shifted windows, leading to improved generation quality. Moreover, we show that offering the knowledge of the absolute position that has been lost in window-based transformers greatly benefits the generation quality. The proposed StyleSwin is scalable to high resolutions, with both the coarse geometry and fine structures benefit from the strong expressivity of transformers. However, blocking artifacts occur during high-resolution synthesis because performing the local attention in a block-wise manner may break the spatial coherency. To solve this, we empirically investigate various solutions, among which we find that employing a wavelet discriminator to examine the spectral discrepancy effectively suppresses the artifacts. Extensive experiments show the superiority over prior transformer-based GANs, especially on high resolutions, e.g., 1024x1024. The StyleSwin, without complex training strategies, excels over StyleGAN on CelebA-HQ 1024, and achieves on-par performance on FFHQ-1024, proving the promise of using transformers for high-resolution image generation. The code and models will be available at https://github.com/microsoft/StyleSwin.
Motivation & Objective
- To investigate whether pure transformers can achieve competitive performance in high-resolution image generation, matching or surpassing ConvNet-based GANs.
- To address the challenge of high computational cost and limited receptive field in standard transformers for image synthesis.
- To mitigate blocking artifacts introduced by block-wise local attention in high-resolution synthesis.
- To restore positional inductive bias lost in window-based self-attention for improved generation quality.
- To demonstrate that transformers can be scaled effectively to 1024×1024 resolution with high-fidelity detail and global coherence.
Proposed method
- Adopts Swin transformer blocks with shifted window self-attention to balance computational efficiency and modeling capacity.
- Introduces double attention that attends to both local and shifted windows in each layer to enlarge effective receptive field.
- Incorporates sinusoidal positional encoding (SPE) at each scale to restore absolute position awareness lost in window-based attention.
- Employs a wavelet discriminator to detect and suppress spectral artifacts, particularly blocking patterns in high-resolution outputs.
- Uses a style-based generator architecture with learned style vectors to control image synthesis at multiple scales.
- Applies data augmentation via bCR (big-Cut-Rand) to improve generalization and reduce overfitting in transformer-based GANs.
Experimental results
Research questions
- RQ1Can a pure transformer-based GAN achieve state-of-the-art performance in high-resolution image generation, particularly at 1024×1024 resolution?
- RQ2How can the limited receptive field of local attention in window-based transformers be effectively expanded without incurring excessive computational cost?
- RQ3Why do blocking artifacts emerge in high-resolution synthesis with block-wise attention, and how can they be mitigated?
- RQ4To what extent does the loss of absolute position information in window-based transformers degrade image generation quality?
- RQ5Can a wavelet discriminator effectively suppress artifacts by examining spectral discrepancies in generated images?
Key findings
- StyleSwin achieves an FID of 4.43 on CelebA-HQ 1024×1024, outperforming all prior transformer-based GANs and matching or exceeding StyleGAN without complex training strategies.
- On FFHQ 1024×1024, StyleSwin achieves an FID of 5.07, approaching the performance of StyleGAN2 and setting a new SOTA for transformer-based GANs.
- The ablation study confirms that double attention reduces FID from 8.40 to 7.86, and the wavelet discriminator further reduces it to 6.34, proving its effectiveness in artifact suppression.
- Sinusoidal positional encoding (SPE) reduces FID from 6.34 to 5.76 on FFHQ-256, demonstrating the importance of absolute position supervision.
- Despite having 40.86M parameters, StyleSwin requires only 50.90B FLOPs at 1024×1024, less than StyleGAN2’s 74.27B FLOPs, indicating lower computational cost.
- The model achieves state-of-the-art FID on both FFHQ and LSUN Church at 256×256 resolution, outperforming StyleGAN2 and prior transformer-based methods.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.