TorchSpatial: A Location Encoding Framework and Benchmark for Spatial Representation Learning

Nemin Wu, Qian Cao, Zhangyu Wang, Zeping Liu, Yanlin Qi, Jielu Zhang, Joshua Ni, Xiaobai Yao, Hongxu Ma, Lan Mu, Stefano Ermon, Tanuja Ganu, Akshay Nambi, Ni Lao, Gengchen Mai

TL;DR

This paper introduces TorchSpatial, a comprehensive framework and benchmark for learning spatial representations from location data. It addresses the lack of standardized tools in geospatial AI by providing a unified location encoding framework, a diverse benchmark suite (LocBench), and novel metrics for evaluating geographic bias, paving the way for more robust and fair geospatial AI models.

What Problem Does This Paper Address?

Geospatial Artificial Intelligence (GeoAI) relies heavily on learning meaningful representations from spatial data like points, lines, and polygons. However, the field has lacked a standardized deep learning framework and benchmark for developing and evaluating these spatial representations, particularly for location encoding. This has led to fragmented research efforts, where each project must reinvent the wheel for data processing, baseline reproduction, and evaluation. Furthermore, existing geo-aware models often exhibit geographic bias, performing unevenly across different regions, and there's a lack of systematic methods to quantify and address this bias. This paper aims to bridge this gap by providing a unified framework, a comprehensive benchmark, and new evaluation metrics.

Methods

The core of TorchSpatial is a unified location encoding framework that supports 15 commonly used location encoders. These encoders are categorized into 2D and 3D types, designed to be scalable and reproducible. For model inference, TorchSpatial offers tailored structures for classification (element-wise multiplication of image and location encoder outputs) and regression (concatenation of image and location embeddings followed by an MLP).

A key innovation is the Geo-Bias Score, a novel evaluation framework designed to quantify geographic bias in geo-aware models. This metric is based on spatial self-information (SSI) and addresses the limitations of traditional spatial autocorrelation statistics by providing numerically comparable scores across different spatial patterns. It introduces two scores: "unmarked SSI geo-bias" (reflecting intrinsic sampling bias) and "marked SSI geo-bias" (reflecting model performance bias).

Datasets

The paper introduces LocBench, a benchmark suite comprising:

  • 7 geo-aware image classification datasets: Including fine-grained species recognition (BirdSnap, NABirds, iNat2017, iNat2018), Flickr image classification (YFCC), and remote sensing image classification (fMoW).
  • 10 geo-aware image regression datasets: Primarily from MOSAIKS (population density, forest cover, nightlight luminosity, elevation) and SustainBench (asset index, sanitation index, child mortality rate, water index, women BMI, women education attainment).

These datasets are chosen to cover diverse task setups, geographic distributions, and dataset sizes.

Key Insights and Ideas

  • Location matters, a lot: Adding location encoders significantly boosts performance across most geo-aware tasks, highlighting the critical role of spatial context.
  • No one-size-fits-all encoder: Different location encoders excel on different datasets and tasks, suggesting that the choice of encoder is task- and data-dependent.
  • Geographic bias is a real concern: While location encoders improve performance, they can also exacerbate geographic bias, underscoring the need for dedicated evaluation metrics.
  • Existing bias metrics are insufficient: Traditional spatial autocorrelation measures are not directly comparable across different models or datasets, necessitating new approaches like the proposed Geo-Bias Score.
  • GPT-4V struggles with fine-grained geospatial tasks: Despite its general capabilities, GPT-4V showed significantly worse performance on species recognition tasks, likely due to the high number of classes and the domain-specific nature of the data.

Key Results

  • Performance Boost: Adding location encoders generally leads to significant improvements in accuracy for classification tasks and better R² scores for regression tasks compared to image-only models. For example, in Table 1, geo-aware models consistently outperform "No Prior" models.
  • Geo-Bias Scores: The paper demonstrates that many location encoders, while improving overall performance, also increase geographic bias (Table 2 and Table 4). For instance, several models show significantly higher unmarked and marked SSI geo-bias scores compared to the location-unaware "No Prior" model.
  • Encoder Performance Variation: Sphere2Vec-sphereC+ was a top performer on several species recognition datasets, while other encoders like tile showed less impact on both performance and bias.

Limitations and Future Work

  • Limited Scope: TorchSpatial currently focuses on location (point) encoding. Future work aims to extend the framework to support other spatial data types like polylines, polygons, and spatial networks.
  • Dataset Expansion: The authors plan to incorporate more geo-aware datasets and tasks into LocBench, including sustainability index prediction, image geolocalization, geographic question answering, and weather forecasting.
  • Hyperparameter Tuning: While the paper provides insights into hyperparameter tuning, reporting error bars for all experiments was prohibitively expensive. Future work may include more comprehensive error bar reporting.
  • GPT-4V Evaluation: The evaluation of GPT-4V was limited due to computational constraints, and its performance on larger datasets was not reported. Further investigation into its capabilities and limitations in geospatial tasks is needed.
  • Geo-Bias Score Refinement: While the Geo-Bias Score is presented as a systematic and universally applicable framework, its practical application and interpretation across a wider range of models and tasks will require further exploration.

Summary updated

BibTeX
@inproceedings{wu2024torchspatial,
  author = {Nemin Wu and Qian Cao and Zhangyu Wang and Zeping Liu and Yanlin Qi and Jielu Zhang and Joshua Ni and Xiaobai Yao and Hongxu Ma and Lan Mu and Stefano Ermon and Tanuja Ganu and Akshay Nambi and Ni Lao and Gengchen Mai},
  title = {{TorchSpatial: A Location Encoding Framework and Benchmark for Spatial Representation Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=Skh7PKP4z6},
}
Figure