Skip to content

v2.0.4

Latest

Choose a tag to compare

@github-actions github-actions released this 31 Jul 01:31
253aa03

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 VH only, 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.
  • 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.
Single-band SAR next to the 3-band composite
  • 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.py and 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 the segmentation_workflow environment.
  • 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 (no onnxruntime, no internet on first use, a bad sar_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.
Model versus Otsu on the same scene

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),
    get SAR_3_band_model.onnx from
    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_threshold while
    model shorelines carry NaN. Filter with extracted_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=15 median 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