Skip to content

fwitmer/CoastlineExtraction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automated Coastline Extraction for Erosion Modeling in Alaska

The primary goal of this project is to enhance the accuracy of coastline extraction, particularly for erosion modeling in Deering, Alaska, using high-resolution Planet imagery with a 3-meter resolution. The project focuses on creating reliable ground truth data and labels that will be used to train the DeepWaterMap algorithm, a deep convolutional neural network designed to segment surface water on multispectral imagery. Originally trained on 30-meter resolution Landsat data, DeepWaterMap will be adapted to work with higher-resolution data in this project.

One of the key challenges in coastline extraction is the application of the Normalized Difference Water Index (NDWI), a widely used remote sensing index for identifying water bodies. However, using a single threshold across an entire image often results in suboptimal accuracy. To address this, I implemented a sliding window approach combined with Otsu thresholding, which dynamically adjusts thresholds over localized regions of the image. This method has shown promising improvements in accuracy.

The newly generated labeled data, derived from this approach, will be used to retrain the DeepWaterMap algorithm, replacing the original Global Surface Water data. This project aims to produce a more accurate and reliable tool for coastline detection, which is crucial for monitoring and mitigating coastal erosion in vulnerable areas like Alaska.

Installation

Prerequisites

Before installing this project, ensure you have the following requirements:

  • Python

    • Project version: Tested and developed with Python 3.13.5
    • Conda environment: Recommended to use Python 3.10 for best compatibility with dependencies
  • Miniconda (for managing conda environments)

  • Git (for cloning the repository)

  • GDAL (install via conda-forge for easier setup)

  • Rasterio 1.4.3+ (for geospatial data processing)


Clone the Repository

Clone the project using the dev branch (this branch contains the latest development features):

git clone -b dev https://github.com/your-username/coastline-extraction.git
cd coastline-extraction

Environment Setup

  1. Create a virtual environment:
python -m venv coastline_env
source coastline_env/bin/activate  # On Windows: coastline_env\Scripts\activate
  1. Install required dependencies:
# Core deep learning libraries
pip install torch torchvision

# Geospatial data processing
pip install rasterio gdal

# Data manipulation and visualization
pip install numpy pandas matplotlib

# Image processing
pip install scikit-image opencv-python

# Utilities
pip install tqdm pillow

# Additional dependencies for data preprocessing
pip install shapely fiona geopandas

Configuration

This project uses a centralized configuration system to manage file paths and parameters. Configuration is handled through config_template.json and the load_config.py module.

Setting Up Configuration

  1. Copy the template:
cp config_template.json config.json
  1. Edit the configuration: Open config.json and modify the paths according to your setup:
{
  "data_dir": "data",
  "image_folder": "sample_data/PlanetLabs",
  "raw_data_folder": "raw_data",
  "shapefile_folder": "USGS_Coastlines",
  "ground_truth_folder": "ground_truth",
  "processed_data_folder": "processed_data",
  "training": {
    "model_save_path": "training_pipeline/unet_model.pth",
    "batch_size": 8,
    "epochs": 30,
    "learning_rate": 1e-4,
    "image_size": [256, 256],
    "train_split": 0.8,
    "device": "auto"
  }
}

Using the Configuration System

The load_config.py module provides convenient functions to access your data files:

from load_config import load_config, get_image_path, get_shapefile_path

# Load configuration
config = load_config()

# Get specific file paths
image_path = get_image_path(config, 0)        # First image file
shapefile_path = get_shapefile_path(config, 0) # First shapefile

Contributing

Working with the Dev Branch

This project uses the dev branch for active development. When contributing:

  1. Fork the repository on GitHub

  2. Clone your fork using the dev branch:

git clone -b dev https://github.com/your-username/coastline-extraction.git
cd coastline-extraction
  1. Create a feature branch from dev:
git checkout -b feature/your-feature-name
  1. Make your changes and commit them:
git add .
git commit -m "Add your feature description"
  1. Push to your fork:
git push origin feature/your-feature-name
  1. Create a Pull Request targeting the dev branch (not main)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages