Skip to content
YunfanKangPublic
forked from cybergis/rs-embed

About

One line code to get any remote sensing foundation model embeddings for any place and any time

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

 
 

Repository files navigation

icon rs-embed

One line code to get Any Remote Sensing Foundation Model (RSFM) embeddings for Any Place and Any Time

arXiv Docs Python PyTorch 2.2

Visitors Last Commit License PyPI Downloads

Docs · StartNow · Releases · Changelog · UseCase · Paper

Get Start on I-GUIDE Today!

TL;DR

emb = get_embedding("prithvi", spatial=..., temporal=..., output=...)

Install

# base install (always use the latest version for best experience)
pip install --upgrade rs-embed

# add [terratorch] only if you use terramind
pip install --upgrade "rs-embed[terratorch]"

For local development:

git clone https://github.com/cybergis/rs-embed.git
cd rs-embed
pip install -e .  # use -e ".[terratorch]" if you need terramind

If this is your first time using Google Earth Engine, authenticate once:

earthengine authenticate

Quick Example

from rs_embed import PointBuffer, TemporalSpec, OutputSpec, get_embedding

spatial = PointBuffer(lon=121.5, lat=31.2, buffer_m=2048)
temporal = TemporalSpec.range(
    "2022-06-01",
    "2022-09-01",
)

emb = get_embedding(
    "prithvi",
    spatial=spatial,
    temporal=temporal,
    output=OutputSpec.pooled(),
)

Tip: Default settings are designed as a trade-off between compute cost and embedding quality. If you have sufficient compute resources, check Choosing Settings and individual model pages to get the best results.

See the visualization helper and end-to-end notebook in the repository:

🚀 Interactive Demo

This repo ships an interactive web app under examples/webapp/ — a Leaflet + FastAPI app where you pick an ROI on the map and either extract embeddings (Extract tab) or run a pretrained downstream head (Use tab):

  • examples/webapp/ — the FastAPI backend (server.py) + map UI (index.html).
  • examples/webapp/prototype.html — mock-data UI you can open directly (no backend, no Earth Engine).

Quick look (no setup)

Just open the mock prototype in a browser — it runs on procedural data:

open examples/webapp/prototype.html        # macOS  (or double-click the file)

Run the web app (live, with Earth Engine)

# 1. environment
python -m venv rsembed
rsembed/bin/pip install -e .                                   # core rs-embed
rsembed/bin/pip install fastapi "uvicorn[standard]" python-multipart   # web-app deps

# 2. authenticate Earth Engine once + set a Cloud project
rsembed/bin/earthengine authenticate
rsembed/bin/earthengine set_project YOUR_GEE_PROJECT

# 3. (optional) build cached assets + the pretrained head used by the "Use" tab
EARTHENGINE_PROJECT=YOUR_GEE_PROJECT rsembed/bin/python examples/build_demo_cache.py --only corn_heads

# 4. launch the server
EARTHENGINE_PROJECT=YOUR_GEE_PROJECT \
  rsembed/bin/python -m uvicorn server:app --app-dir examples/webapp --port 8000

Then open http://localhost:8000:

  • ① Extract — right-click the map for a 2 km box (or right-drag a freeform box) → Sentinel-2 preview → embeddings, downloadable as an .npz package.
  • ② Use — pick a model, right-click the map, then Predict here → corn-presence prediction from a pretrained head; or upload an embedding package.

The build_demo_cache.py --only corn_heads step (GEE-native, USDA CDL labels — no external files) trains the head used by the Use tab. It needs Earth Engine auth. The Extract tab works live without it.

Main API

For new users, start with these primary APIs:

  • get_embedding(...): one ROI -> one embedding
  • get_embeddings_batch(...): many ROIs, same model
  • export_batch(...): export datasets / experiments (single or multiple ROIs)
  • inspect_provider_patch(...): inspect raw provider patches before inference

Supported Models

This is a convenience index with basic model info only (for quick scanning / links). For detailed I/O behavior and preprocessing notes, see Supported Models.

Precomputed Embeddings

Model ID Resolution Time Coverage Publication
tessera 10m 2017-2025 CVPR 2026
gse (Alpha Earth) 10 m 2017-2024 arXiv 2025
copernicus 0.25° 2021 ICCV 2025

On-the-fly Foundation Models

Model ID Primary Input Resolution(Default) Publication Link
satmae S2 RGB 10m NeurIPS 2022 link
satmaepp S2 RGB 10m CVPR 2024 link
satmaepp_s2_10b S2 SR 10-band 10m CVPR 2024 link
prithvi S2 6-band 30m arXiv 2023 link
scalemae S2 RGB (+ scale) 10m ICCV 2023 link
remoteclip S2 RGB 10m TGRS 2024 link
dofa Multi-band + wavelengths 10m arXiv 2024 link
satvision TOA 14-channel 1000m arXiv 2024 link
anysat S2 time series (10-band) 10m CVPR 2025 link
galileo S2 time series (10-band) 10m ICML 2025 link
wildsat S2 RGB 10m ICCV 2025 link
fomo S2 12-band 10m AAAI 2025 link
terramind S2 12-band 10m ICCV 2025 link
terrafm S2 12-band / S1 VV-VH 10m ICLR 2026 link
thor S2 10-band 10m arXiv 2026 link
agrifm S2 time series (10-band) 10m RSE 2026 link

Resolution here means the default provider/source fetch resolution used by the adapter, not the final resized tensor shape seen by the model.

Learn More

📚 Full documentation

🪄 Get Started: Try rs-embed Now

🪀 Use case: Maize yield mapping Illinois

📢 Disscusion

🧾 Release policy and versioning

📌 Project changelog

Extending & Contributing

We welcome issues for new model integrations, extension ideas, bugs, and documentation gaps. If you have your own work, or a model or paper that you think would be valuable to include in rs-embed, please open an Issue and share the relevant links, context, and examples.

We also warmly welcome community contributions, including new model support, bug fixes, documentation improvements, and example notebooks. If you would like to contribute directly, please start with the extending guide and the contributing guide.

🎖 Acknowledgements

We would like to thank the following organizations and projects that make rs-embed possible: Google Earth Engine, TorchGeo, GeoTessera, TerraTorch, rshf, and the Copernicus-Embed.

This library also builds upon the incredible work of the Remote Sensing community!(Full list and citations available in our Documentation)

Citation

@article{ye2026modelplacetimeremote,
      title={Any Model, Any Place, Any Time: Get Remote Sensing Foundation Model Embeddings On Demand},
      author={Dingqi Ye and Daniel Kiv and Wei Hu and Jimeng Shi and Shaowen Wang},
      year={2026},
      eprint={2602.23678},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2602.23678},
}

License

This project is released under the Apache-2.0

Contributors

About

One line code to get any remote sensing foundation model embeddings for any place and any time

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages