DL4GAM#

class torchgeo.datasets.DL4GAMAlps(root='data', split='train', cv_iter=1, version='small', bands=('B4', 'B3', 'B2', 'B8', 'B11'), extra_features=None, transforms=None, download=False, checksum=False)[source]#

Bases: NonGeoDataset

A Multi-modal Dataset for Glacier Mapping (Segmentation) in the European Alps.

The dataset consists of Sentinel-2 images from 2015 (mainly), 2016 and 2017, and binary segmentation masks for glaciers, based on an inventory built by glaciology experts (Paul et al. 2020).

Given that glacier ice is not always visible in the images, due to seasonal snow, shadow/cloud cover and, most importantly, debris cover, the dataset also includes additional features that can help in the segmentation task.

Dataset features:

  • Sentinel-2 images (all bands, including cloud and shadow masks which can be used for loss masking)

  • glacier mask (0: no glacier, 1: glacier)

  • debris mask (0: no debris, 1: debris) based on a mix of three publications (Scherler et al. 2018, Herreid & Pellicciotti 2020, Linsbauer et al. 2021)

  • DEM (Copernicus GLO-30) + five derived features (using xDEM): slope, aspect, terrain ruggedness index, planform and profile curvatures

  • dh/dt (surface elevation change) map over 2010-2015 (Hugonnet et al. 2021)

  • v (surface velocity) map over 2015 (ITS_LIVE)

Other specifications:

  • temporal coverage: one acquisition per glacier, from either 2015 (mainly), 2016, or 2017

  • spatial coverage: only glaciers larger than 0.1 km2 are considered (n=1593, after manual QC), totalling ~1685 km2 which represents ~93% of the total inventory area for this region

  • 2251 patches sampled with overlap from the 1593 glaciers; or 11440 for the large version, obtained with an increased sampling overlap

  • the dataset download size is 5.8 GB (11 GB when unarchived); or 29.5 GB (52 GB when unarchived) for the large version

  • the dataset is provided at 10m GSD (after bilinearly resampling some of the Sentinel-2 bands and the additional features which come at a lower resolution)

  • the dataset provides fixed training, validation, and test geographical splits (70-10-20, by glacier area)

  • five different splits are provided, according to a five-fold cross-validation scheme

  • all the features/masks are stacked and provided as NetCDF files (one or more per glacier), structured as data/{glacier_id}/{glacier_id}_{patch_number}_{center_x}_{center_y}.nc

  • data is projected and geocoded in local UTM zones

For more details check also: https://huggingface.co/datasets/dcodrut/dl4gam_alps

If you use this dataset in your research, please cite the following paper:

Note

This dataset requires the following additional libraries to be installed:

Added in version 0.7.

__init__(root='data', split='train', cv_iter=1, version='small', bands=('B4', 'B3', 'B2', 'B8', 'B11'), extra_features=None, transforms=None, download=False, checksum=False)[source]#

Initialize the dataset.

Parameters:
  • root (str | PathLike[str]) – root directory where dataset can be found

  • split (str) – one of “train”, “val”, or “test”

  • cv_iter (int) – one of 1, 2, 3, 4, 5 (for the five-fold geographical cross-validation scheme)

  • version (str) – one of “small” or “large” (controls the sampling overlap)

  • bands (Sequence[str]) – the Sentinel-2 bands to use as input (default: RGB + NIR + SWIR)

  • extra_features (Sequence[str] | None) – additional features to include (default: None; see the class attribute for the available)

  • transforms (Callable[[dict[str, Any]], dict[str, Any]] | None) – a function/transform that takes input sample and its target as entry and returns a transformed version

  • download (bool) – if True, download dataset and store it in the root directory

  • checksum (bool) – if True, check the MD5 of the downloaded files (may be slow)

Raises:
__len__()[source]#

The length of the dataset.

Returns:

the number of patches in the dataset

Return type:

int

__getitem__(index)[source]#

Load the NetCDF file for the given index and return the sample as a dict.

Parameters:

index (int) – index of the sample to return

Returns:

a dictionary containing the sample with the following:

  • the Sentinel-2 image (selected bands)

  • the glacier mask (binary mask with all the glaciers in the current patch)

  • the debris mask

  • the cloud and shadow mask

  • the additional features (DEM, derived features, etc.) if required

Return type:

dict

plot(sample, show_titles=True, suptitle=None, clip_extrema=True)[source]#

Plot a sample from the dataset.

Parameters:
  • sample (dict[str, Any]) – a sample returned by __getitem__()

  • show_titles (bool) – flag indicating whether to show titles above each panel

  • suptitle (str | None) – optional string to use as a suptitle

  • clip_extrema (bool) – flag indicating whether to clip the lowest/highest 2.5% of the values for contrast enhancement

Returns:

a matplotlib Figure with the rendered sample

Raises:

RGBBandsMissingError – If bands does not include all RGB bands.

Return type:

Figure

__annotate_func__()#

The type of the None singleton.