arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2111.05464cs.CV
收藏

Transformers比CNN更健壮吗?

Are Transformers More Robust Than CNNs?

Johns Hopkins University(约翰斯·霍普金斯大学);University of California, Santa Cruz(加州大学圣克鲁兹分校)

Yutong Bai, Jieru Mei, Alan Yuille, Cihang Xie

摘要:

Transformer作为视觉识别的强大工具而出现。除了在广泛的视觉基准测试中表现出有竞争力的性能外,最近的研究还认为Transformers比卷积神经网络(CNN)更强大。尽管如此,令人惊讶的是,我们发现这些结论是从不公平的实验环境中得出的,其中Transformers和CNN在不同的尺度上进行了比较,并采用了不同的训练框架。在本文中,我们的目标是提供Transformers和CNN之间的第一个公平和深入的比较,重点是鲁棒性评估。通过我们的统一训练设置,我们首先挑战了以前的信念,即在测量对抗鲁棒性时,Transformers胜过CNN。更令人惊讶的是,我们发现CNN可以很容易地像Transformers一样强大,如果它们正确地采用Transformers的训练配方,就可以抵御对抗攻击。虽然关于分布外样本的泛化,但我们表明,在(外部)大规模数据集上进行预训练并不是使Transformers实现比CNN更好性能的基本要求。此外,我们的消融表明,这种更强的泛化能力在很大程度上得益于Transformer的自我注意力结构本身,而不是其他训练设置。我们希望这项工作可以帮助社区更好地理解和基准测试Transformers和CNN的鲁棒性。代码和模型可在https://github.com/ytongbai/ViTs-vs-CNNs上公开获取。

英文摘要:

Transformer emerges as a powerful tool for visual recognition. In addition to demonstrating competitive performance on a broad range of visual benchmarks, recent works also argue that Transformers are much more robust than Convolutions Neural Networks (CNNs). Nonetheless, surprisingly, we find these conclusions are drawn from unfair experimental settings, where Transformers and CNNs are compared at different scales and are applied with distinct training frameworks. In this paper, we aim to provide the first fair & in-depth comparisons between Transformers and CNNs, focusing on robustness evaluations. With our unified training setup, we first challenge the previous belief that Transformers outshine CNNs when measuring adversarial robustness. More surprisingly, we find CNNs can easily be as robust as Transformers on defending against adversarial attacks, if they properly adopt Transformers' training recipes. While regarding generalization on out-of-distribution samples, we show pre-training on (external) large-scale datasets is not a fundamental request for enabling Transformers to achieve better performance than CNNs. Moreover, our ablations suggest such stronger generalization is largely benefited by the Transformer's self-attention-like architectures per se, rather than by other training setups. We hope this work can help the community better understand and benchmark the robustness of Transformers and CNNs. The code and models are publicly available at https://github.com/ytongbai/ViTs-vs-CNNs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑