[论文解读] StyleSwin: Transformer-based GAN for High-resolution Image Generation
StyleSwin 通过在基于风格的生成器中集成 Swin 变压器、双重注意力机制和正弦位置编码,提出了一种基于变压器的 GAN,用于高分辨率图像生成,以增强感受野和空间一致性。其在 CelebA-HQ 1024×1024 上实现了 4.43 的 SOTA FID 分数,在 FFHQ 1024×1024 上实现了 5.07 的 FID 分数,无需复杂的训练策略,优于 StyleGAN。
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.
研究动机与目标
- 探究纯变压器架构是否能在高分辨率图像生成中实现具有竞争力的性能,达到或超越基于卷积神经网络的 GAN。
- 解决标准变压器在图像合成中计算成本高且感受野有限的挑战。
- 缓解基于窗口的局部注意力在高分辨率合成中引入的块状伪影。
- 恢复基于窗口的自注意力中丢失的位置归纳偏差,以提升生成质量。
- 证明变压器可有效扩展至 1024×1024 分辨率,实现高保真细节和全局一致性。
提出的方法
- 采用带有移位窗口自注意力的 Swin 变压器模块,以在计算效率和建模能力之间取得平衡。
- 引入双重注意力机制,使每一层都能同时关注局部窗口和移位窗口,以扩大有效感受野。
- 在每个尺度上引入正弦位置编码(SPE),以恢复基于窗口注意力中丢失的绝对位置感知。
- 采用小波判别器检测并抑制频谱伪影,特别是高分辨率输出中的块状图案。
- 使用基于风格的生成器架构,通过学习到的风格向量在多个尺度上控制图像生成。
- 通过 bCR(大裁剪-随机)数据增强方法提升泛化能力并减少基于变压器的 GAN 中的过拟合。
实验结果
研究问题
- RQ1纯变压器架构的 GAN 是否能在高分辨率图像生成中实现 SOTA 性能,特别是在 1024×1024 分辨率下?
- RQ2如何在不引入过高计算成本的前提下,有效扩展基于窗口的变压器中局部注意力的有限感受野?
- RQ3为何在基于块的注意力机制下高分辨率合成中会出现块状伪影,以及如何缓解这一问题?
- RQ4基于窗口的变压器中绝对位置信息的丢失在多大程度上会降低图像生成质量?
- RQ5小波判别器是否能通过检查生成图像中的频谱差异,有效抑制伪影?
主要发现
- StyleSwin 在 CelebA-HQ 1024×1024 上实现了 4.43 的 FID 分数,优于所有先前的基于变压器的 GAN,并且在无需复杂训练策略的情况下与 StyleGAN 相当或更优。
- 在 FFHQ 1024×1024 上,StyleSwin 实现了 5.07 的 FID 分数,接近 StyleGAN2 的性能,并为基于变压器的 GAN 设定了新的 SOTA 记录。
- 消融实验表明,双重注意力将 FID 从 8.40 降低至 7.86,而小波判别器进一步将其降至 6.34,证明其在伪影抑制方面的有效性。
- 正弦位置编码(SPE)在 FFHQ-256 上将 FID 从 6.34 降低至 5.76,表明绝对位置监督的重要性。
- 尽管参数量为 40.86M,StyleSwin 在 1024×1024 分辨率下仅需 50.90B FLOPs,低于 StyleGAN2 的 74.27B FLOPs,表明其计算成本更低。
- 该模型在 256×256 分辨率下于 FFHQ 和 LSUN Church 上均实现了 SOTA FID 分数,优于 StyleGAN2 和先前的基于变压器的方法。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。