Sentinel-1 (SAR) workflow update
Sentinel-1 support has been overhauled. CoastSeg now downloads both the VV and VH polarizations
instead of VH alone, and maps shorelines with a new 3-band SAR segmentation model instead of an
Otsu threshold.
Highlights
-
Sentinel-1 downloads now fetch VV and VH
- Previously CoastSeg requested
VHonly, so each scene was a single band. - The new model needs both polarizations, so both the VV and VH are downloaded by default.
- Action required: ROIs downloaded before this release are VH-only. Re-run the download for
those sites and the missing band is fetched, overwriting the existing scenes in place.
- Previously CoastSeg requested
-
New 3-band SAR segmentation model
- Each scene is stacked into a
[VV, VH, VV-VH]dB composite, so the model sees a much more
detailed version of the same acquisition than a single grey band when only the VH was used. - VV, VH and VV-VH respond differently to water, wet sand, vegetation and urban
surfaces. - The new SAR model is hosted on Hugging Face at
2320sharon/SAR_3_band_model.
- Each scene is stacked into a
-
The new SAR 3 band model is now the default for SAR in both workflows
- It runs in the CoastSat workflow (
extract_all_shorelines) and the Zoo workflow
(4_zoo_workflow_SAR.pyand the SAR notebook) with no settings change. - Nothing downstream changed: the shoreline is still the land/water boundary inside the reference
shoreline buffer, so transects, tide correction and sessions behave as before. - The SAR model runs in-process through
onnxruntime, so unlike the other Zoo models it does
not need thesegmentation_workflowenvironment.
- It runs in the CoastSat workflow (
-
Otsu thresholding is now only a fallback method for SAR
- Set
sar_segmentation = "otsu"to force it, or let CoastSeg use it automatically when the model
cannot be loaded (noonnxruntime, no internet on first use, a badsar_model_path). - Otsu needs a cleanly bimodal backscatter histogram, so it drifts on wind-roughened water, wet
sand and radar shadow, and the drift changes from date to date. Below is the same scene with the
same settings — only the segmentation differs.
- Set
Getting the model
- By default, do nothing. The model (~130 MB) is not shipped with CoastSeg. On the first SAR run
it is downloaded from Hugging Face into a per-user cache folder outside the repository, so both
workflows share one copy and later runs reuse it. - To download it manually (offline machines, restricted networks, or your own retrained model),
getSAR_3_band_model.onnxfrom
Hugging Face and save it to
CoastSeg/models/SAR_segmentation_model/. A model in that folder always wins over the download and
both workflows find it with no settings change. - To load one from anywhere else, point the workflow at it:
# CoastSat workflow: the .onnx file itself
coastsegmap.set_settings(sar_model_path=r"models/SAR_segmentation_model/SAR_3_band_model.onnx")
# Zoo workflow: the folder holding the .onnx
model_setting = {"img_type": "SAR", "local_model_path": r"models/SAR_segmentation_model"}New settings
| setting | workflow | default | what it does |
|---|---|---|---|
sar_segmentation |
CoastSat | "model" |
"model" runs the 3-band model; "otsu" forces the legacy threshold for the whole run |
sar_water_threshold |
both | 0.5 |
P(water) cutoff. Raise it to classify less of the scene as water, lower it to catch more |
sar_model_path |
CoastSat | "" |
Your own .onnx. Stored relative to the CoastSeg folder so sessions stay portable |
local_model_path |
Zoo | "" |
Folder holding your own .onnx; "" uses/downloads models/SAR_segmentation_model |
sar_mask_nodata |
Zoo | True |
Excludes the empty parts of a SAR swath so they are not traced as land |
sar_overwrite_segmentation |
Zoo | True |
Re-segments scenes whose outputs already exist |
sar_segmentation and sar_water_threshold have widgets on the advanced settings tab; the model
paths are set through set_settings or config.json.
Other updates
- Every shoreline now records how it was segmented in
output["segmentation_method"], and
extracted_shoreline.report_sar_segmentation_methods(output)tallies a finished run — useful
because individual scenes can fall back to Otsu even when the rest of the run used the model. - When comparing outputs, note that Otsu shorelines carry a dB threshold in
MNDWI_thresholdwhile
model shorelines carryNaN. Filter withextracted_shoreline.threshold_filter_applies(output)
rather than reading that column directly, or the model rows are silently dropped. - No speckle filtering is applied any more. The old workflow ran a
size=15median filter over
the imagery before thresholding it. The SAR imagery is now left untouched — the model reads the raw
dB bands and was trained that way, so smoothing them would only blur the shoreline.
What's Changed
- Release v2.0.4 by @2320sharon in #323
Full Changelog: v2.0.3...v2.0.4