Geographic Location Encoding with Spherical Harmonics and Sinusoidal Representation Networks

Marc Rußwurm, Konstantin Klemmer, Esther Rolf, Robin Zbinden, Devis Tuia

Abstract

This paper introduces a superior approach to teaching machine learning models about geographic location by utilizing Spherical Harmonics (SH) and Sinusoidal Representation Networks (SirenNets). By treating the Earth as a sphere rather than a flat rectangle, the authors eliminate common data artifacts at the poles and set new state-of-the-art performance records across climate and ecology benchmarks.

Introduction: The Problem with Flat Maps

Most machine learning models do not natively "understand" latitude and longitude. These coordinates must be transformed into a high-dimensional representation—a positional encoding—that the model can process.

Current state-of-the-art methods, such as the Double Fourier Sphere (DFS), treat the globe as a flat, rectangular map. This creates a major mathematical headache: at the North and South Poles, all lines of longitude converge to a single point. Rectangular encodings ignore this convergence, leading to visual or predictive "artifacts" at high latitudes. Furthermore, researchers have historically focused on the encoding function itself while ignoring the architecture of the neural network that processes it, often defaulting to standard fully connected residual networks (FCNet).

Methodology

The authors propose a two-pronged solution to address both the encoding and the architectural shortcomings:

1. Spherical Harmonics (SH) as Positional Encodings

Instead of using sines and cosines on a flat plane, the researchers employ Spherical Harmonics—basis functions natively defined on the surface of a sphere. These act as the spherical equivalent of the Fourier transform, making them mathematically "aware" of the poles and eliminating the streaking artifacts caused by rectangular projections.

2. SirenNets as the Neural Architecture

The authors replace standard networks with Sinusoidal Representation Networks (SirenNets), which use sine waves as activation functions rather than standard ReLUs.

Overview of the neural network architectures compared: the standard FCNet and the proposed SirenNet.

A key theoretical contribution of the paper is proving that a single-layer SirenNet is mathematically equivalent to a learned version of traditional geographic embeddings. This explains why SirenNets are so effective at capturing high-frequency spatial details: they essentially learn the optimal frequencies for geographic encoding during training, rather than relying on researchers to hard-code them.

Experimental Setup

The researchers evaluated their approach across four diverse tasks:

  • Fibonacci-Lattice Checkerboard: A synthetic toy dataset designed to test how well a model can resolve fine-grained, high-frequency patterns on a sphere.
  • Land-Ocean Classification: A task requiring the model to learn the global coastline from a sparse set of points.
  • Multi-variable ERA5 Interpolation: A real-world climate dataset where the model must predict eight different variables (like temperature and wind speed) across the globe.
  • iNaturalist 2018: A massive dataset of geolocated images used to see if location data can help a model better identify plant and animal species.

Key Insights and Results

The Impact of Resolution and Architecture

By increasing the number of Legendre polynomials ($L$) in the Spherical Harmonics, the model's "vision" becomes sharper. Combining high-order SH with a SirenNet allows the model to resolve incredibly fine details that previous models missed.

Visualizing how increasing the number of Legendre polynomials (L) and using SirenNets improves the model's ability to resolve fine-grained landmass details.

State-of-the-Art Performance

  • Synthetic & Geographic Benchmarks: The combination of SH and SirenNet achieved the highest accuracy on both the Checkerboard (95.8%) and Land-Ocean (95.8%) tasks.
  • Climate Modeling Breakthrough: On the ERA5 climate data, the proposed method reduced the Mean Squared Error (MSE) to 0.58, a massive improvement over the previous best of 1.38.
  • Species Identification: Adding the SH-SirenNet location prior to an image classifier increased top-1 accuracy on iNaturalist by 12.3%, outperforming all other encoding methods.
  • Efficiency: While Spherical Harmonics can be computationally expensive, the authors developed an analytic pre-computed implementation that is significantly faster than standard iterative methods.

Limitations and Future Work

The primary limitation of this approach is the trade-off between resolution and computation: higher-order Spherical Harmonics ($L > 40$) require more memory and processing power. Additionally, while the model performs exceptionally well at the poles, many real-world datasets (like iNaturalist) have very little data in those regions, making it hard to fully realize the benefits in some applications.

The authors suggest that future work could explore even more parameter-efficient ways to learn these spherical representations, potentially moving toward "foundation models" for geographic space.

Summary updated

BibTeX
@inproceedings{ruwurm2024geographic,
  author = {Marc Rußwurm and Konstantin Klemmer and Esther Rolf and Robin Zbinden and Devis Tuia},
  title = {{Geographic Location Encoding with Spherical Harmonics and Sinusoidal Representation Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=PudduufFLa},
}
Figure