CaFFe#

class torchgeo.datasets.CaFFe(root='data', split='train', transforms=None, download=False, checksum=False)[source]#

Bases: NonGeoDataset

CaFFe (CAlving Fronts and where to Find thEm) dataset.

The CaFFe dataset is a semantic segmentation dataset of marine-terminating glaciers.

Dataset features:

  • 13,090 train, 2,241 validation, and 3,761 test images

  • varying spatial resolution of 6-20m

  • paired binary calving front segmentation masks

  • paired multi-class land cover segmentation masks

Dataset format:

  • images are single-channel pngs with dimension 512x512

  • segmentation masks are single-channel pngs

Dataset classes:

  1. N/A

  2. rock

  3. glacier

  4. ocean/ice melange

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

Added in version 0.7.

__init__(root='data', split='train', transforms=None, download=False, checksum=False)[source]#

Initialize a new instance of CaFFe dataset.

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

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

  • 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]#

Return the number of images in the dataset.

__getitem__(index)[source]#

Return the image and mask at the given index.

Parameters:

index (int) – index of the image and mask to return

Returns:

a dict containing the image and mask

Return type:

dict

plot(sample, show_titles=True, suptitle=None)[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

Returns:

a matplotlib Figure with the rendered sample

Return type:

Figure

__annotate_func__()#

The type of the None singleton.