Vaihingen#

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

Bases: NonGeoDataset

Vaihingen 2D Semantic Segmentation dataset.

The Vaihingen dataset is a dataset for urban semantic segmentation used in the 2D Semantic Labeling Contest - Vaihingen. This dataset uses the “ISPRS_semantic_labeling_Vaihingen.zip” and “ISPRS_semantic_labeling_Vaihingen_ground_truth_COMPLETE.zip” files to create the train/test sets used in the challenge. The dataset can be downloaded from here. Note, the server contains additional data for 3D Semantic Labeling which are currently not supported.

Dataset format:

  • images are 3-channel RGB geotiffs

  • masks are 3-channel geotiffs with unique RGB values representing the class

Dataset classes:

  1. Clutter/background

  2. Impervious surfaces

  3. Building

  4. Low Vegetation

  5. Tree

  6. Car

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

Added in version 0.2.

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

Initialize a new Vaihingen2D dataset instance.

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

  • split (str) – one of “train” 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

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

Raises:
__getitem__(index)[source]#

Return an index within the dataset.

Parameters:

index (int) – index to return

Returns:

data and label at that index

Return type:

dict[str, Any]

__len__()[source]#

Return the number of data points in the dataset.

Returns:

length of the dataset

Return type:

int

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

  • alpha (float) – opacity with which to render predictions on top of the imagery

Returns:

a matplotlib Figure with the rendered sample

Return type:

Figure

__annotate_func__()#

The type of the None singleton.