Skip to content

Code repository for the paper "Landslide mapping from Sentinel-2 imagery through change detection" (accepted at IGARSS 2024)

License

Notifications You must be signed in to change notification settings

links-ads/igarss-landslide-delineation

Repository files navigation

Landslide mapping from Sentinel-2 imagery through change detection

Code repository for the paper "Landslide mapping from Sentinel-2 imagery through change detection" (accepted at IGARSS 2024, and presented at ESA LPS 2025)

arXiv

Get started

To run code in this repository, you first have to install required libraries

pip install -r requirements.txt

Then, you have to download the S2 image dataset for each inventory by running the Jupyter Notebooks in processing/.

To train a model, you can run train.py specifying hyperparameters as arguments. Arguments can be given either as command line arguments (e.g. python train.py --encoder="resnet50") or specified in a YAML configuration file (e.g. python train.py --yaml="configs/bbunet.yaml"), or even both. If both a YAML config and command line arguments are specified in the command, command line arguments eventually override YAML arguments. If an argument is not specified, a default value is used, as specified in src/arg_parser.py).

To specify a pretrained backbone through the --pretrained_encoder_weights argument, you have to manually download the corresponding "full checkpoint" from the SSL4EO-S12 repository first.

In configs/ you can find hyperparameters used to train the models reported in the paper. Thus, the experiments in the paper can be run simply by:

python train.py --yaml="configs/model.yaml"

Checkpoints

The models trained in the paper can be found at this link. The following code is used to load a model:

import torch
from argparse import Namespace
from src.model_utils import make_model

# load trained checkpoint
ckpt_path = "path/to/model.pt"
ckpt = torch.load(ckpt_path, map_location='cpu')
hparams = ckpt['hparams']

# load model architecture
model = make_model(hparams)

# load trained weights into model
model.load_state_dict(ckpt['state_dict'])

About

Code repository for the paper "Landslide mapping from Sentinel-2 imagery through change detection" (accepted at IGARSS 2024)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published