File size: 4,391 Bytes
5a3a334
 
130d28c
 
 
 
 
 
 
5a3a334
130d28c
 
 
 
 
 
 
0cb34c4
 
130d28c
 
 
 
ef37540
130d28c
 
 
 
 
 
 
 
 
ef37540
 
 
130d28c
 
 
 
 
 
1ea9a46
 
 
130d28c
 
 
 
 
fe46611
130d28c
 
 
 
 
 
 
 
 
ef37540
 
 
 
 
 
 
 
 
 
 
 
130d28c
ef37540
 
130d28c
 
 
 
 
 
 
 
 
ef37540
130d28c
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
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](https://doi.org/10.31223/X5M22F).
Inference code: [huizhml/vsm-model](https://github.com/huizhml/vsm-model). Training code:
[huizhml/global-vegetation-structure](https://github.com/huizhml/global-vegetation-structure).

## Usage

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

```python
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](https://github.com/huizhml/vsm-model/blob/main/notebooks/tutorial.ipynb) ([open in Colab](https://colab.research.google.com/github/huizhml/vsm-model/blob/main/notebooks/tutorial.ipynb)).

## 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](https://github.com/huizhml/vsm-model) 1.1.0 (git tag `v1.1.0`) |

## Citation

```bibtex
@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}
}
```