WiGNet: Windowed Vision Graph Neural Network

Gabriele Spadaro, Marco Grangetto, Attilio Fiandrotti, Enzo Tartaglione, Jhony H. Giraldo

Abstract

Vision Graph Neural Networks (ViGs) represent image patches as nodes in a graph to capture complex, non-local relationships. However, the standard $k$-Nearest Neighbors ($k$-NN) approach for graph construction scales quadratically with the number of patches, creating a significant bottleneck for high-resolution images. This paper introduces WiGNet, a scalable ViG architecture that utilizes a Window-based Grapher module. By partitioning feature maps into local windows and performing graph operations within them, WiGNet reduces computational complexity from quadratic to linear. WiGNet achieves 78.8% Top-1 accuracy on ImageNet-1k and demonstrates superior memory efficiency on high-resolution tasks compared to existing ViG variants.

Introduction: The Scalability Challenge in Vision GNNs

While Convolutional Neural Networks (CNNs) and Transformers have dominated computer vision, Vision GNNs (ViGs) have emerged as a compelling alternative due to their ability to learn irregular and long-range dependencies. By treating image patches as nodes, ViGs can model interactions that are not constrained by a fixed grid.

Despite their potential, ViGs face a major scalability hurdle. The process of building a graph—typically via $k$-NN—requires calculating distances between all pairs of patches, resulting in $O(N^2)$ complexity where $N$ is the number of patches. As image resolution grows, the memory and compute requirements become prohibitive. WiGNet addresses this by constraining graph construction to local windows, as illustrated in the comparison below.

Comparison between standard Vision GNN (global graph) and WiGNet (windowed graph).

The WiGNet Architecture

The core innovation of WiGNet is the Window-based Grapher. Instead of constructing a single global graph, the model adopts a "divide and conquer" approach.

Window-based Grapher Module

The architecture follows a hierarchical structure similar to modern vision backbones. After an initial stem layer, the feature map is processed through a series of WiGNet blocks. Each block consists of a Window-based Grapher and a Feed-Forward Network (FFN).

  1. Window Partitioning: The input feature map is divided into non-overlapping windows (e.g., $8 \times 8$).
  2. Local Graph Construction: Within each window, a local graph is built using $k$-NN. Because the window size is constant, the complexity of this step scales linearly with the total number of patches.
  3. Dynamic Graph Convolution: A "Max-Relative" graph convolution updates node features by aggregating information from their local neighbors.
  4. Shifted Windows: To facilitate cross-window communication, WiGNet employs a shifted windowing mechanism in alternating layers. This ensures that information is not trapped within isolated "silos" and can propagate across the entire image over multiple layers.
The WiGNet architecture (a) and the detailed Window-based Grapher module (b).

Experimental Evaluation

WiGNet was evaluated on ImageNet-1k for general classification and CelebA-HQ for high-resolution adaptability.

Performance on ImageNet-1k

WiGNet-Ti (Tiny) achieves a 78.8% Top-1 accuracy, surpassing the original ViG-Ti (78.2%) while maintaining a similar parameter count. This confirms that local graph construction does not necessarily sacrifice the representative power of the model for standard classification tasks.

Efficiency at High Resolution

The advantages of WiGNet become most apparent at higher resolutions. On $512 \times 512$ images from the CelebA-HQ dataset, WiGNet requires only ~0.5 GB of GPU memory. In contrast, GreedyViG-S requires over 1.5 GB to achieve comparable performance. Furthermore, as image size scales from $224^2$ to $1120^2$, WiGNet’s computational cost (MACs) and memory usage grow linearly, whereas standard ViG models exhibit quadratic growth.

Discussion and Future Work

WiGNet successfully breaks the quadratic bottleneck of Vision GNNs, making them viable for high-resolution applications. A key finding is that the "Shifted Windows" mechanism is particularly vital for high-resolution tasks, providing a ~6% accuracy boost on CelebA-HQ by enabling necessary inter-window communication.

A current limitation is that a single layer lacks a global view of the image. While hierarchical downsampling and window shifting provide a path for global information flow, future research could explore hybrid approaches that incorporate sparse global connections or dynamic neighbor selection at window boundaries to further enhance long-range dependency modeling without losing linear efficiency.

Summary updated

BibTeX
@inproceedings{spadaro2025wignet,
  author = {Gabriele Spadaro and Marco Grangetto and Attilio Fiandrotti and Enzo Tartaglione and Jhony H. Giraldo},
  title = {{WiGNet: Windowed Vision Graph Neural Network}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2025},
  doi = {10.1109/wacv61041.2025.00093},
}
Figure