Skip to content

How to Use the Zoo Notebook

  • ⚠️ Ensure you have downloaded data from Google Earth Engine before running Zoo models
  • ⚠️ Zoo notebook runs one region of interest (ROI) at a time

⚠️ WARNING (please read) ⚠️

To use the full functionality of SDS_zoo_classifier.ipynb, you must install the zoo workflow with Pixi. Before following this guide, complete the setup steps in How to Install the Segmentation (Zoo) Workflow.

If you cannot use Pixi and must use Conda, you can still download models from this notebook, but you cannot run the models inside the notebook. Instead, follow How to Run Models to run the zoo models in a separate Conda environment. This limitation exists because the model requirements are not compatible with the core CoastSeg environment.

The rest of this guide assumes you followed the instructions in How to Install the Segmentation (Zoo) Workflow and have already created the pixi environment for segmentation_workflow and have switched back to the main CoastSeg environment (coastseg).

Run Start Up Cell

zoo_run_cell

Step 1: Select Settings

  • Select the settings you would like for your current session
  • Make sure to click the save settings button to ensure your settings have been applied (Can check in the view settings tab)
  • For more information on these settings see the Extract Shorelines Settings Guide

zoo_step2

Step 2: Upload Files

  • Upload a GeoJSON file that contains either transects or shorelines
  • If both the transects and shorelines are within the same ‘config_gdf.geojson’ file, you will need to upload the same file for the reference shoreline and the transects
  • If no file is provided, CoastSeg will attempt to load an available file for you
    • If no transects or shorelines are available within the region of interest, an error will occur

zoo_step3

Example of Uploading Transects & Shorelines GeoJSON Files

zoo_preview_uploaded_feature

Step 3: Extract Shorelines with Model

There are two options for extracting shorelines depending on which environment you installed in the guide How to Install the Zoo Workflow.

  • If you followed the instructions to install the segmentation_workflow with pixi , then you will follow workflow a.

  • If you instead installed the conda environment for the segmentation_workflow then you will follow the guide How to Run Zoo Models to generate a folder of segmentations for your chosen site, then follow workflow b.

zoo_two_workflow_options_extract_shorelines

Workflow A: Run Model and Extract Shorelines

1: Select a model - Select the Model input you would like to use (RGB, MNDWI, or NDWI) - The NDWI and MNDWI will be automatically created using avalible RGB imagery

zoo_step1

Basic Model Settings

  • By default the global segformer model is selected

2: Session Name - Enter a name for your session. A new folder will be created with this name in the ‘sessions’ directory

3: Select Images - Select the RGB directory from your region of interest (roi) with downloaded imagery from the ‘data’ directory

4: Run Model

zoo_step4

Example of Step 4 set up

Red arrow showing the RGB folder to be selected containing the images for shoreline extraction. Green arrow showing the final step to extract shorelines.

zoo_step4_details

Example of a running session in progress

  • ⚠️ Zoo workflow takes longer on average to complete than the CoastSat workflow.
    • This is because the zoo workflow loads a more advanced model that takes longer to process all the imagery in a session.
    • In the screeshot below you can see the progress bar, called "Applying Model", updates as the zoo model finishes running on each image. (note the warnings are normal)

zoo_step4_run_model zoo_step4_run_model_pt2

Workflow b: Extract from Existing Segmentations

  • This assumes that you already have a folder of segmentations from running one of the models in CoastSeg/segmentation_workflow/run_zoo_segmentation_models.py

1: Select the folder full of segmentations

  • This folder should be in CoastSeg/sessions for example CoastSeg/sessions/model_outputs

2: Click the button 'Extract Shorelines from Folder'

  • This will read the segmentations in the folder and extract shorelines from them

Step 5: Tidal Correction

  • Ensure the tide model has been downloaded to CoastSeg/tide_model for tidal correction to work
  • Follow the guide to download the tide model
  • Ensure shorelines have been extracted prior to tidal correction. Not all imagery will contain suitable shorelines and result in tide correction being not possible

Step 1: Section a Session - Select a session from the ‘sessions’ directory that contains extracted shorelines

Step 2: Run Tidal Correction - Runs the tide model and saves tidally corrected CSV files in the selected sessions directory

Select between the FES 2014 or FES 2022 model before clicking correct tides.

  • Tidal correction will take a few minutes to run because the tide model is large, several GB

zoo_step5