Segment Anything Model for Road Network Graph Extraction

Congrui Hetang, Haoru Xue, Cindy X. Le, Tianwei Yue, Wenping Wang, Yihui HeWorkshops @ CVPR 2024 · DOI

Abstract

We propose SAM-Road, an adaptation of the Segment Anything Model (SAM) for extracting large-scale, vectorized road network graphs from satellite imagery. To predict graph geometry, we formulate it as a dense semantic segmentation task, leveraging the inherent strengths of SAM. The image encoder of SAM is fine-tuned to produce probability masks for roads and intersections, from which the graph vertices are extracted via simple non-maximum suppression. To predict graph topology, we designed a lightweight transformer-based graph neural network, which leverages the SAM image embeddings to estimate the edge existence probabilities between vertices. Our approach directly predicts the graph vertices and edges for large regions without expensive and complex post-processing heuristics, and is capable of building complete road network graphs spanning multiple square kilometers in a matter of seconds. With its simple, straightforward, and minimalist design, SAM-Road achieves comparable accuracy with the state-of-the-art method RNGDet++, while being 40 times faster on the City-scale dataset. We thus demonstrate the power of a foundational vision model when applied to a graph learning task.

1. Introduction

Extracting road networks from satellite imagery is a fundamental challenge in computer vision, essential for applications ranging from GPS navigation to autonomous vehicle path planning. The task requires more than simple pixel-level identification; it necessitates the creation of a functional, vectorized graph consisting of nodes (vertices) and edges.

Historically, researchers have faced a trade-off between two paradigms:

  1. Segmentation-based methods: These models are fast but produce "messy" heat maps that require complex, hand-crafted heuristics like thinning to generate a graph. These heuristics often fail at complex intersections.
  2. Graph-based (Autoregressive) methods: These models iteratively "walk" the road network to produce clean graphs. While accurate, they are computationally expensive and difficult to parallelize, making them impractical for large-scale mapping.

SAM-Road bridges this gap by adapting the Segment Anything Model (SAM) to extract large-scale road networks with high topological accuracy and unprecedented speed.

2. Methodology

SAM-Road decouples the extraction process into two distinct stages: geometry prediction and topology reasoning.

2.1 Geometry Prediction

The model utilizes a fine-tuned SAM image encoder (specifically the ViT-B variant) to perform dense semantic segmentation. Instead of a single mask, the encoder is trained to produce two separate probability masks: one for roads and one for intersections. By treating intersections as a distinct class, the model avoids the common pitfall of "blurry" or disconnected junctions. Discrete graph vertices are then extracted from these masks using a simple Non-Maximum Suppression (NMS) algorithm.

2.2 Topology Reasoning

To determine connectivity, SAM-Road employs a lightweight, transformer-based Graph Neural Network (GNN). For any given pair of vertices, the model extracts SAM’s rich image embeddings at those specific coordinates using bilinear sampling. The transformer then predicts the probability of an edge existing between those points. This approach leverages the semantic richness of SAM’s pre-trained embeddings, which contain significant information about road structure even with minimal fine-tuning.

2.3 Parallelized Inference

Unlike autoregressive models that predict nodes sequentially, SAM-Road utilizes a sliding-window inference strategy. Because each window is processed independently, the system can be fully parallelized on a GPU. This architectural choice is the primary driver behind the model's significant speed advantages.

3. Experimental Results

The researchers evaluated SAM-Road on two industry-standard benchmarks: City-scale (covering 20 U.S. cities) and SpaceNet (covering diverse global locations like Shanghai and Las Vegas).

3.1 Speed and Efficiency

On the City-scale dataset, SAM-Road demonstrated a massive performance leap. It produced a full road network graph in just 4.6 minutes, compared to 231 minutes for the previous state-of-the-art model, RNGDet++. This represents a 40x speedup, making city-wide mapping feasible in minutes rather than hours.

3.2 Accuracy and Robustness

SAM-Road achieved the highest TOPO precision (90.47%) on the City-scale dataset and set new records for Average Path Length Similarity (APLS), a metric that evaluates how well the extracted graph preserves real-world routing distances. Visually, the model successfully handles complex urban structures, such as parallel freeways and multi-lane overpasses, that typically confuse standard segmentation models.

4. Discussion and Limitations

The success of SAM-Road underscores the power of foundational vision models. SAM’s embeddings, trained on billions of general-purpose masks, prove to be highly effective for specialized tasks like road topology reasoning.

A current limitation is the model's "flat" 2D perspective. Because it relies on top-down satellite imagery, it can struggle to distinguish verticality in multi-level bridges or complex interchanges where roads cross without intersecting.

5. Conclusion

SAM-Road provides a minimalist yet powerful framework for road network extraction. By combining the representational strength of SAM with a parallelized GNN, it achieves state-of-the-art results with a fraction of the computational cost. Future work will explore scaling to larger SAM variants (ViT-L/H) and implementing parameter-efficient fine-tuning methods like LoRA to further optimize the system.

Summary updated

BibTeX
@inproceedings{hetang2024segment,
  author = {Congrui Hetang and Haoru Xue and Cindy X. Le and Tianwei Yue and Wenping Wang and Yihui He},
  title = {{Segment Anything Model for Road Network Graph Extraction}},
  booktitle = {Workshops @ CVPR},
  year = {2024},
  doi = {10.1109/cvprw63382.2024.00262},
}
Figure