Neighborhood Attention Makes the Encoder of ResUNet Stronger for Accurate Road Extraction

Ali Jamali, Swalpa Kumar Roy, Jonathan Li, Pedram Ghamisi

TL;DR

The ResUNetFormer is a novel deep learning architecture that combines the structural strengths of U-Net with the efficiency of Neighborhood Attention Transformers (NAT) to extract roads from high-resolution aerial imagery. By replacing computationally expensive global self-attention with localized neighborhood attention and utilizing heterogeneous convolutions, the model achieves state-of-the-art accuracy with significantly less "segmentation noise" than traditional CNNs or standard Vision Transformers.

What Problem Does This Paper Address?

Road extraction from satellite and aerial imagery is a cornerstone of modern cartography, urban planning, and autonomous navigation. However, it remains a "profoundly difficult" task. Roads are often obscured by tree canopies (occlusions), shadows, or buildings, and they can easily be confused with similar-looking features like parking lots or bare soil.

While Convolutional Neural Networks (CNNs) like U-Net are excellent at capturing local textures, they often struggle to grasp the long-range spatial context needed to follow a continuous road network. Conversely, Vision Transformers (ViTs) are great at capturing global context but suffer from quadratic computational complexity, making them slow and memory-intensive for high-resolution imagery. The authors sought a middle ground: a model that captures context efficiently without the massive overhead of standard Transformers.

Methods

The authors introduce ResUNetFormer, which sits on a 7-layer ResUNet backbone. Its architecture is defined by three key innovations:

  1. Neighborhood Attention Transformer (NAT): Instead of the standard "global" self-attention (where every pixel looks at every other pixel), NAT uses a sliding window approach. Each pixel only attends to its immediate neighbors. This results in linear computational complexity while still allowing the model to learn spatial dependencies better than a standard convolution.
  2. Heterogeneous Convolutions (HetConv): In the "V2" version of the model, standard convolutions are replaced with HetConv. This technique uses different kernel sizes (e.g., combining $3 \times 3$ depth-wise kernels with $1 \times 1$ point-wise kernels) within a single layer. This increases the efficiency of the representation without significantly increasing the parameter count.
  3. Residual Learning & U-Net Structure: The model retains the classic U-Net "encoder-decoder" shape with skip connections. Residual units (identity mappings) are used to prevent the "vanishing gradient" problem, allowing the network to be trained deeply and effectively.

The NAT block is strategically placed in the "bridge" section—the bottleneck between the encoder (which compresses the image) and the decoder (which reconstructs the road map).

Datasets

The model was evaluated using the Massachusetts Roads Dataset (MRD), a popular benchmark containing 1,171 high-resolution aerial images (1500 × 1500 pixels) covering urban, suburban, and rural areas.

The researchers tested the model under two specific scenarios to check for robustness:

  • MRD100: Training on only 100 images (testing performance with limited data).
  • MRD800: Training on 800 images (testing performance with more abundant data).

Key Insights and Ideas

  • The "Local-Global" Sweet Spot: The most important insight is that for road extraction, global attention is often overkill. Roads are essentially local linear features. By limiting attention to a neighborhood (using $r=3$), NAT captures enough context to maintain road continuity without wasting memory on distant, irrelevant pixels.
  • Noise Suppression: A recurring theme in the results is that ResUNetFormer produces "cleaner" maps. Traditional CNNs often produce "salt-and-pepper" noise (random isolated pixels), while standard ViTs can sometimes over-smooth. The hybrid approach maintains sharp edges while filtering out background clutter.
  • Efficiency Matters: By using NAT and HetConv, the authors demonstrate that you can outperform "heavyweight" models like SwinUNet and Attention UNet while keeping the computational cost manageable for high-resolution remote sensing tasks.

Key Results

The ResUNetFormer-V2 (the version using HetConv) consistently outperformed state-of-the-art models across multiple metrics:

  • Recall & Dice Coefficient: In the MRD100 scenario, the model achieved a Recall of 45.59% and a Dice Coefficient of 0.5113, significantly higher than the baseline ResUNet (41.3% and 0.469, respectively).
  • Precision: The V1 version of the model achieved a staggering 95.3% precision in the 100-image scenario, meaning when it predicted a road, it was almost always correct.
  • Visual Quality: Qualitative results (visual maps) showed that ResUNetFormer was much better at preserving the connectivity of narrow roads compared to UNet++ or SwinUNet, which often showed "broken" road segments.

Limitations and Future Work

While the results are impressive, the paper notes a few areas for further exploration:

  • Fixed Window Size: The study primarily used a neighboring window of $r=3$. The authors suggest that exploring different window sizes or dynamic windows could further optimize performance.
  • Data Augmentation: Interestingly, the authors chose not to use data augmentation in this study to keep the comparison "pure." In a real-world production environment, adding augmentation would likely boost these scores even higher.
  • Computational Benchmarking: While the paper mentions NAT reduces computational costs compared to vanilla ViTs, a detailed breakdown of FLOPs (floating-point operations) or inference time compared to standard CNNs was not explicitly provided in this letter.

Summary updated

BibTeX
@article{jamali2024neighborhood,
  author = {Ali Jamali and Swalpa Kumar Roy and Jonathan Li and Pedram Ghamisi},
  title = {{Neighborhood Attention Makes the Encoder of ResUNet Stronger for Accurate Road Extraction}},
  journal = {IEEE Geosci. Remote. Sens. Lett.},
  year = {2024},
  doi = {10.1109/lgrs.2024.3354560},
}
Figure