Views
No views yet
1pip install mlstac
2# runtime dependencies for this model:
3pip install torch segmentation-models-pytorch pytorch-lightning timm rasterio numpy1import mlstac
2
3# 1. Load the metadata and download the model files
4model = mlstac.load(
5 "https://huggingface.co/isp-uv-es/CHRIS-PROBA1/resolve/main/mlm.json"
6)
7local = model.download("CHRIS-PROBA1")
8
9# 2. Build the ensemble (loads both checkpoints)
10net = local.compiled_model(device="cuda")
11
12# 3a. Segment a raw CHRIS GeoTIFF end to end.
13# mode_n is the CHRIS acquisition mode; source is 'dn' or 'toa'
14# (or None to guess it from the file name).
15mask = local.module.predict_chris(
16 "image_mode_1/scene_DN.tif", model=net, mode_n=1, source="dn"
17)
18
19# 3b. Mode 6 is CHRIS mode 20: 4 raw bands, DN only (no TOA).
20mask20 = local.module.predict_chris(
21 "image_mode_20/scene_DN.tif", model=net, mode_n=6, source="dn"
22)(4, H, W), you can skip the CHRIS
preprocessing and call the model directly:mask = local.module.predict_large(rgbn_array, model=net)| Value | Class |
|---|---|
| 0 | clear |
| 1 | thick cloud |
| 2 | thin cloud |
| 3 | shadow |
| 99 | nodata |
mode_n | CHRIS mode | DN | TOA |
|---|---|---|---|
| 1 | 1 | ✓ | ✓ |
| 2 | 2 | ✓ | ✓ |
| 3 | 3 | ✓ | ✓ |
| 4 | 4 | ✓ | ✓ |
| 5 | 5 | ✓ | ✓ |
| 6 | 20 | ✓ | — |
source matters. Pass source='dn' or source='toa', or leave it as
None to infer it from the file name.examples/ folder holds one paired scene per mode (image_mode_1 ...
image_mode_5 with DN and TOA, image_mode_20 with DN only) to try the model.