nerf-earth / README.md
calebrob6's picture
Add n10, smooth_global_seed65 and hashgrid_depth4_seed54 location encoders
e1e304c verified
|
Raw History Blame Contribute Delete
3 kB
metadata
license: mit
library_name: pytorch
pipeline_tag: feature-extraction
tags:
  - location-encoder
  - geospatial
  - implicit-neural-representation
  - siren
  - hash-grid

NeRF-Earth

Location encoders: neural fields over the globe that map a latitude/longitude to a unit-length embedding, for use as features in downstream geospatial models (e.g. a linear or k-NN probe). Each model is a learned multiresolution hash grid on the sphere followed by a SIREN MLP; coordinates are the only input.

Model Dim Weights Training signal CoordBench R² (random / spatial)
n10 1,023 4.5 GB Overture Maps labels + distillation from Overture/Wikipedia encoders 0.733 / 0.568
smooth_global_seed65 256 6 MB Wikipedia contrastive + GeoCLIP distillation 0.564 / 0.219
hashgrid_depth4_seed54 256 7 MB Wikipedia contrastive 0.544 / 0.214

The Wikipedia signal is ~12.7M geotagged articles in 320 languages, contrastively aligned with their Cohere embed-multilingual-v3 text embeddings.

Usage

pip install torch numpy safetensors huggingface_hub
hf download calebrob6/nerf-earth nerf_earth.py --local-dir .
from nerf_earth import load

encoder = load("n10", device="cuda")  # or "smooth_global_seed65", "hashgrid_depth4_seed54"
features = encoder.encode(lat=[40.7128, -33.8688], lon=[-74.0060, 151.2093])
print(features.shape)  # (2, 1023), float32, unit-length rows
  • Inputs are latitude, longitude in degrees (WGS84), in that order.
  • encoder(coords) is the PyTorch path: coords is an [N, 2] (lat, lon) tensor on the model's device.
  • n10 needs about 4.5 GB of CPU or GPU memory for its weights.
  • load("path/to/folder") loads a local copy of a model folder (config.json + model.safetensors).

PCA maps

The first three principal components (centered PCA) of each model's embeddings over all land, on a 5 km equal-area grid, shown as RGB. Colors are not comparable between models.

n10 n10 PCA

smooth_global_seed65 smooth_global_seed65 PCA

hashgrid_depth4_seed54 hashgrid_depth4_seed54 PCA

Notes

  • CoordBench scores are macro R² over 35 regression benchmarks from the NeuralFTW standard suite (ridge probe; random and 10° spatial-block splits). These benchmarks were also used during model development, so treat them as development results. Overture layers used to train n10 overlap some benchmark targets.
  • Training data: Wikipedia (CC BY-SA), Overture Maps (n10), and the GeoCLIP location encoder as a teacher (smooth_global_seed65).