kelp-skema
Binary kelp canopy segmentation model for Sentinel-2 L2A imagery, developed by Mohsen Ghanbari (@m5ghanba) at the Spectral Lab, University of Victoria. This repository hosts an ONNX export of the original SKeMa model_s2bandsandindices_only model (HuggingFace Β· GitHub), re-packaged for use with habitat-mapper. Normalization and spectral index computation are baked into the inference graph, so the model accepts raw Sentinel-2 DN values directly.
Model
| ONNX file | Channels in | Auxiliary data | Source weights |
|---|---|---|---|
Unet_tu-maxvit_tiny_tf_512_20261014.onnx |
5 | None | SKeMa v0.4.0 modelS2Only.pth (m5ghanba/SKeMa@0fad01a) |
This is the SKeMa default model. It uses only Sentinel-2 bands and derived spectral indices, so it needs no bathymetry or substrate layers.
Architecture
UNet with a MaxViT-tiny encoder (tu-maxvit_tiny_tf_512, tile size 512), implemented via segmentation-models-pytorch.
The model's forward pass:
- Accepts raw Sentinel-2 DN values (uint16 range, 0β~10000) as float32
- Computes spectral indices internally (NDVI, NDWI, GNDVI, CIG, NDVIre)
- Normalizes the augmented channel stack with baked-in per-channel mean/std
- Runs the UNet backbone
- Returns raw logits (apply sigmoid + threshold externally)
Internal channel layout after augmentation:
| ch | Channel |
|---|---|
| 0 | B02 (Blue) |
| 1 | B03 (Green) |
| 2 | B04 (Red) |
| 3 | B08 (NIR) |
| 4 | B05 (Red Edge) |
| 5 | NDVI |
| 6 | NDWI |
| 7 | GNDVI |
| 8 | CIG |
| 9 | NDVIre |
Baked-in Normalization Parameters
Applied as (x - mean) / std after index augmentation (from SKeMa v0.4.0).
mean = [208.88829040527344, 270.1573181152344, 152.23983764648438, 986.3375244140625, 326.3395690917969,
0.05615551024675369, 0.16349990665912628, -0.16349990665912628, 1.635742425918579, 0.10964486002922058]
std = [159.06369018554688, 218.41119384765625, 208.40899658203125, 1296.7060546875, 379.7621765136719,
0.6531456708908081, 0.7117241024971008, 0.7117241024971008, 3.844733953475952, 0.39051857590675354]
Usage
The recommended way to run this model is via habitat-mapper:
hab segment kelp-skema <input.SAFE> <output.tif>
Direct ONNX inference
The model accepts batched float32 input of shape (B, 5, H, W) with bands ordered B02, B03, B04, B08, B05 (B05 resampled to 10 m). Values should be raw Sentinel-2 L2A DN values with the processing baseline offset removed (subtract 1000 for baseline β₯ 4.0, leave as-is for older baselines, then clip to 0).
import onnxruntime as ort
import numpy as np
session = ort.InferenceSession("Unet_tu-maxvit_tiny_tf_512_20261014.onnx")
logits = session.run(["output"], {"input": tile.astype(np.float32)})[0]
predictions = (1 / (1 + np.exp(-logits)) > 0.5).astype(np.uint8)
Intended Use
This model is intended for mapping surface kelp canopy extent from multispectral Sentinel-2 satellite imagery, primarily in coastal British Columbia, Canada. It is not validated for other species or regions.
Limitations
- Trained on Sentinel-2 L2A (atmospherically corrected) data. Results on L1C data are not validated.
- Performance degrades under heavy cloud cover, sun glint, or turbid water conditions typical of intertidal zones.
- Canopy kelp only β subsurface kelp is not detectable from multispectral imagery.
Citation
If you use this model in your work, please cite the following paper:
Ghanbari, M., Ernst, N., Denouden, T.A., Reshitnyk, L.Y., Steffen, P., Wachmann, A., Mora-Soto, A., Loos, E., Hessing-Lewis, M., Dedeluk, N., & Costa, M. (2026). Deep Learning-Based Mapping of Floating Kelp Forests from Sentinel-2 Imagery. Remote Sensing, 18(20), 3604. https://doi.org/10.3390/rs18203604
@article{Ghanbari_2026_SKeMa,
author = {Ghanbari, Mohsen and Ernst, Neil and Denouden, Taylor A. and Reshitnyk, Luba Y. and
Steffen, Piper and Wachmann, Alena and Mora-Soto, Alejandra and Loos, Eduardo and
Hessing-Lewis, Margot and Dedeluk, Nic and Costa, Maycira},
title = {Deep Learning-Based Mapping of Floating Kelp Forests from Sentinel-2 Imagery},
journal = {Remote Sensing},
volume = {18},
number = {20},
pages = {3604},
year = {2026},
doi = {10.3390/rs18203604}
}
The original model weights and inference code are available at:
License
MIT β see LICENSE.