Labels clouds and cloud shadows in CHRIS/PROBA-1 scenes as clear, cloud or
shadow, plus 255 for nodata. One ensemble covers all six acquisition modes.
CHRIS records tens of narrow bands, in a different order in every mode, so the loader first builds the four inputs the model was trained on (red, green, blue and NIR) from the bands of that mode, and then segments the whole scene.
pip install mlstac pytorch-lightning segmentation-models-pytorch timm rasterio
import mlstac
model = mlstac.load("https://huggingface.co/isp-uv-es/CHRIS-PROBA1/resolve/main/mlm.json")
local = model.download("CHRIS-PROBA1")
net = local.compiled_model(device="cuda")
mask = local.module.predict_chris("scene_TOA.tif", model=net, mode_n=3, source="toa")
# 0 = clear, 1 = cloud, 2 = shadow, 255 = nodata
On 55 hand-painted CHRIS scenes, split by flight and never seen in training, each
one going through the full inference path in load.py:
| Metric | Value | Aggregation |
|---|---|---|
| mIoU | 0.708 | mean per scene |
| IoU clear / cloud / shadow | 0.898 / 0.831 / 0.652 | pixels pooled |
| Macro F1 | 0.881 | pixels pooled |
| Cohen's kappa | 0.854 | pixels pooled |
| Accuracy | 0.921 | pixels pooled |
The first row averages scenes, the rest pool every valid pixel. By mode: 0.784 (12 scenes), 0.697 (5), 0.699 (12), 0.576 (5), 0.658 (3) and 0.711 (18) for modes 1 to 5 and 20. Modes 2, 4 and 5 have five scenes or fewer, so read those as indicative.
Each panel is one mode. The four coloured lanes are the inputs this ensemble uses: the wide curve is the Sentinel-2 response and the blocks are the CHRIS bands of that mode that build it, darker when they weigh more. The grey lanes below are the extra Sentinel-2 bands that mode can also build, for a model trained with more than four inputs.
Mode 3, for instance: B4 from bands 7 and 8, B3 from 4 and 5, B2 from 2 and 3, NIR
from 14, 15 and 16. The weights come from comparing each CHRIS response with the
Sentinel-2 one, and they are listed per mode in bands.json. You do not need to
touch this: predict_chris reads the mode and builds the four channels for you.
Three U-Nets, averaged:
| Checkpoint | Encoder |
|---|---|
checkpoints/convnext_a.ckpt |
ConvNeXtV2-nano |
checkpoints/convnext_b.ckpt |
ConvNeXtV2-nano |
checkpoints/regnety.ckpt |
RegNetY-004 |
Inference walks the scene in 640 px windows with 320 px overlap, snaps the last window to the edge so nothing is padded, normalises each window per band with a z-score, averages the softmax of the three checkpoints and blends the windows with a gradient mask. Around 0.3 s per 748 x 744 scene on an RTX A5500, 4 s on CPU.
| File | source |
Notes |
|---|---|---|
| TOA product | "toa" |
reflectance x10000, the usual case |
| Radiance | "rad" |
what mode 20 is usually delivered as |
| Raw DN | "dn" |
accepted, less accurate |
Modes 1 to 5 and mode 20 are supported, passed as mode_n=1 … mode_n=20. Mode 1
is binned to 372 x 374, so its window shrinks to 352 px; the rest are 744 px wide,
with 748 rows in most acquisitions and up to 1024 in some mode 2 products.
With your own four-band stack:
mask = local.module.predict_large(rgbn, model=net) # rgbn: (4, H, W) float
Per-pixel confidence:
probs = local.module.predict_chris("scene_TOA.tif", model=net, mode_n=3,
source="toa", return_probs=True)
cloud.load.py mlstac loader
mlm.json model card, STAC/mlm format
bands.json CHRIS to red/green/blue/NIR table per acquisition mode
checkpoints/ the three networks
examples/mode_<n>/ one scene per mode, with its painted mask and the prediction
figures/ metrics, example, band mapping, gallery
notebook.ipynb Colab walkthrough
metrics.json per-class and per-mode numbers
MIT licence.
back_v1/convnextv2.ckpt 224 MBcheckpoints/convnext_a.ckpt 224 MBcheckpoints/convnext_b.ckpt 224 MBback_v1/regnety.ckpt 81 MBcheckpoints/regnety.ckpt 81 MB