vsm / README.md
HuiZ's picture
Model card: link to the tutorial notebook
1ea9a46 verified
|
Raw History Blame Contribute Delete
4.39 kB
metadata
license: mit
library_name: pytorch
tags:
  - remote-sensing
  - sentinel-2
  - gedi
  - vegetation-structure
  - canopy-height

VSM: a vertical vegetation structure model of the Earth

VSM predicts the vertical structure of vegetation at 10 m resolution from Sentinel-2 images: the GEDI relative-height metrics RH0 to RH100 of every pixel, each with three predictive quantiles, plus a land-cover class. It was trained on Sentinel-2 L2A images and GEDI footprints. Paper: A vertical vegetation structure model of the Earth. Inference code: huizhml/vsm-model. Training code: huizhml/global-vegetation-structure.

Usage

pip install "git+https://github.com/huizhml/vsm-model@v1.1.0"
import vsm_model

model = vsm_model.load("HuiZ/vsm", device="cuda")
out = model.predict(s2, x, y, crs="EPSG:32632", variables=["RH25_Q1", "RH98_Q1"])
out["rh"]          # float32 (n_images, 2, h, w), metres
out["land_cover"]  # int8 (n_images, h, w)

# one map from several images of the same area, masked and merged as the global VSM maps
rh = model.composite(out["rh"], out["land_cover"], scl)   # float32 (2, h, w), NaN where masked

predict() normalises the images, adds the latitude / longitude channels and runs the image in tiles. The values it uses (band mean / std, encoding, tile size) are read from config.json in this repo, so they always belong to these weights.

Tutorial notebook, from Sentinel-2 download to a canopy height map: tutorial.ipynb (open in Colab).

Input

  • s2: (n_images, 12, h, w) or (12, h, w). Sentinel-2 L2A digital numbers (reflectance x 10000) at 10 m, on the scale used before processing baseline 04.00: for products with baseline >= 04.00 clip at 1000 and subtract 1000 (BOA_ADD_OFFSET) first. Nodata is 0.
  • Band order: B01, B04, B03, B02, B05, B06, B07, B08, B8A, B09, B11, B12.
  • x, y: projected coordinates of the pixel centres (x per column, y per row) and their crs. predict() derives latitude and longitude from them.

Images of different dates are predicted one by one; each needs its own cloud mask.

Output

  • rh: 303 channels named RH<n>_Q<q>, n = 0 to 100, in metres. Q0 is the 0.95 quantile. Q1 is the 0.5 quantile. Q2 is the 0.05 quantile.
  • land_cover: index of the most likely class in 0 unknown, 1 Tree cover, 2 Shrubland, 3 Grassland, 4 Cropland, 5 Built-up, 6 Bare / sparse vegetation, 7 Snow and ice, 8 Permanent water bodies, 9 Herbaceous wetland and mangroves, 10 Moss and lichen, 11 unused.

predict() returns a prediction for every pixel of every image, also under clouds and on water.

Masking and merging images

composite(rh, land_cover, scl) turns the predictions of several images into one map, with the steps used for the global VSM maps. scl is the Sentinel-2 scene classification of the same images, (n_images, h, w) at 10 m.

  • Per image, pixels with SCL 0, 1, 3, 8, 9, 10, 11 or predicted snow are dropped.
  • The map is the per-pixel median of the remaining images.
  • Pixels that are water (SCL or predicted class) or built-up (predicted class) in most images are masked (NaN).

For the global maps, up to 20 images of the growing season were used per Sentinel-2 tile. The maps store decimetres as int16, nodata 32767.

Weights

  • Training run cg11fpjr. The bias of the last layer is corrected by the mean error on the training set (me_gradual_slope_veg), as in the global prediction.
  • A pixel's prediction depends on its 15 x 15 pixel neighbourhood.
Weights Code
this version vsm-model 1.1.0 (git tag v1.1.0)

Citation

@misc{zhang2026vertical,
  title     = {A vertical vegetation structure model of the {Earth}},
  author    = {Zhang, Hui and Lang, Nico and Mazurczyk, Mikolaj and Oehmcke, Stefan and Huang, Ke and Brandt, Martin and Fensholt, Rasmus and Kariryaa, Ankit and Igel, Christian},
  year      = {2026},
  publisher = {EarthArXiv},
  note      = {Preprint},
  doi       = {10.31223/X5M22F},
  url       = {https://doi.org/10.31223/X5M22F}
}