GeoNRW#

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

Bases: NonGeoDataset

GeoNRW dataset.

This datasets contains RGB, DEM and segmentation label data from North Rhine-Westphalia, Germany.

Dataset features:

  • 7298 training and 485 test samples

  • RGB images, 1000x1000px normalized to [0, 1]

  • DEM images, unnormalized

  • segmentation labels

Dataset format:

  • RGB images are three-channel jp2

  • DEM images are single-channel tif

  • segmentation labels are single-channel tif

Dataset classes:

  1. background

  2. forest

  3. water

  4. agricultural

  5. residential,commercial,industrial

  6. grassland,swamp,shrubbery

  7. railway,trainstation

  8. highway,squares

  9. airport,shipyard

  10. roads

  11. buildings

Additional information about the dataset can be found on this site.

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

Added in version 0.6.

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

Initialize the GeoNRW dataset.

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

  • 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 data points in the dataset.

Returns:

length of the dataset

Return type:

int

__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]

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 suptitle to use for figure

Returns:

a matplotlib Figure with the rendered sample

Return type:

Figure

__annotate_func__()#

The type of the None singleton.