Table of Contents
Fetching ...

Global Filter Networks for Image Classification

Yongming Rao, Wenliang Zhao, Zheng Zhu, Jiwen Lu, Jie Zhou

TL;DR

GFNet introduces a frequency-domain approach to image classification, replacing costly self-attention with a learnable global filter layer implemented via 2D FFT/IFFT to model long-range token interactions with log-linear complexity. The method achieves competitive accuracy on ImageNet and transfer tasks while scaling gracefully to higher resolutions, and it demonstrates favorable efficiency and robustness compared to transformers and CNNs. Theoretical and empirical analyses show that frequency-domain filters act as depthwise global convolutions, enabling flexible, scalable token mixing. Overall, GFNet provides a practical, high-performance alternative for high-resolution vision tasks with reduced computational burden.

Abstract

Recent advances in self-attention and pure multi-layer perceptrons (MLP) models for vision have shown great potential in achieving promising performance with fewer inductive biases. These models are generally based on learning interaction among spatial locations from raw data. The complexity of self-attention and MLP grows quadratically as the image size increases, which makes these models hard to scale up when high-resolution features are required. In this paper, we present the Global Filter Network (GFNet), a conceptually simple yet computationally efficient architecture, that learns long-term spatial dependencies in the frequency domain with log-linear complexity. Our architecture replaces the self-attention layer in vision transformers with three key operations: a 2D discrete Fourier transform, an element-wise multiplication between frequency-domain features and learnable global filters, and a 2D inverse Fourier transform. We exhibit favorable accuracy/complexity trade-offs of our models on both ImageNet and downstream tasks. Our results demonstrate that GFNet can be a very competitive alternative to transformer-style models and CNNs in efficiency, generalization ability and robustness. Code is available at https://github.com/raoyongming/GFNet

Global Filter Networks for Image Classification

TL;DR

GFNet introduces a frequency-domain approach to image classification, replacing costly self-attention with a learnable global filter layer implemented via 2D FFT/IFFT to model long-range token interactions with log-linear complexity. The method achieves competitive accuracy on ImageNet and transfer tasks while scaling gracefully to higher resolutions, and it demonstrates favorable efficiency and robustness compared to transformers and CNNs. Theoretical and empirical analyses show that frequency-domain filters act as depthwise global convolutions, enabling flexible, scalable token mixing. Overall, GFNet provides a practical, high-performance alternative for high-resolution vision tasks with reduced computational burden.

Abstract

Recent advances in self-attention and pure multi-layer perceptrons (MLP) models for vision have shown great potential in achieving promising performance with fewer inductive biases. These models are generally based on learning interaction among spatial locations from raw data. The complexity of self-attention and MLP grows quadratically as the image size increases, which makes these models hard to scale up when high-resolution features are required. In this paper, we present the Global Filter Network (GFNet), a conceptually simple yet computationally efficient architecture, that learns long-term spatial dependencies in the frequency domain with log-linear complexity. Our architecture replaces the self-attention layer in vision transformers with three key operations: a 2D discrete Fourier transform, an element-wise multiplication between frequency-domain features and learnable global filters, and a 2D inverse Fourier transform. We exhibit favorable accuracy/complexity trade-offs of our models on both ImageNet and downstream tasks. Our results demonstrate that GFNet can be a very competitive alternative to transformer-style models and CNNs in efficiency, generalization ability and robustness. Code is available at https://github.com/raoyongming/GFNet

Paper Structure

This paper contains 21 sections, 21 equations, 8 figures, 9 tables, 1 algorithm.

Figures (8)

  • Figure 1: The overall architecture of the Global Filter Network. Our architecture is based on Vision Transformer (ViT) models with some minimal modifications. We replace the self-attention sub-layer with the proposed global filter layer, which consists of three key operations: a 2D discrete Fourier transform to convert the input spatial features to the frequency domain, an element-wise multiplication between frequency-domain features and the global filters, and a 2D inverse Fourier transform to map the features back to the spatial domain. The efficient fast Fourier transform (FFT) enables us to learn arbitrary interactions among spatial locations with log-linear complexity.
  • Figure 2: Comparisons among GFNet, ViT dosovitskiy2020vit and ResMLP touvron2021resmlp in (a) FLOPs (b) latency and (c) GPU memory with respect to the number of tokens (feature resolution). The dotted lines indicate the estimated values when the GPU memory has run out. The latency and GPU memory is measured using a single NVIDIA RTX 3090 GPU with batch size 32 and feature dimension 384.
  • Figure 3: ImageNet acc. vs model complexity.
  • Figure 4: Comparisons among the GFNet and other variants based on the transformer-like architecture on ImageNet. We show that GFNet outperforms the ResMLP touvron2021resmlp, FNet lee2021fnet and models with local depthwise convolutions. We also report the number of parameters and theoretical complexity in FLOPs.
  • Figure 5: Visualization of the learned global filters in GFNet-XS. We visualize the original frequency domain global filters in (a) and show the corresponding spatial domain filters for the first 6 columns in (b). There are more clear patterns in the frequency domain than the spatial domain.
  • ...and 3 more figures