HySpecNet-11k#

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

Bases: NonGeoDataset

HySpecNet-11k dataset.

HySpecNet-11k is a large-scale benchmark dataset for hyperspectral image compression and self-supervised learning. It is made up of 11,483 nonoverlapping image patches acquired by the EnMAP satellite. Each patch is a portion of 128 x 128 pixels with 224 spectral bands and with a ground sample distance of 30 m.

To construct HySpecNet-11k, a total of 250 EnMAP tiles acquired during the routine operation phase between 2 November 2022 and 9 November 2022 were considered. The considered tiles are associated with less than 10% cloud and snow cover. The tiles were radiometrically, geometrically and atmospherically corrected (L2A water & land product). Then, the tiles were divided into nonoverlapping image patches. The cropped patches at the borders of the tiles were eliminated. As a result, more than 45 patches per tile are obtained, resulting in 11,483 patches for the full dataset.

We provide predefined splits obtained by randomly dividing HySpecNet into:

  1. a training set that includes 70% of the patches,

  2. a validation set that includes 20% of the patches, and

  3. a test set that includes 10% of the patches.

Depending on the way that we used for splitting the dataset, we define two different splits:

  1. an easy split, where patches from the same tile can be present in different sets (patchwise splitting); and

  2. a hard split, where all patches from one tile belong to the same set (tilewise splitting).

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

Added in version 0.7.

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

Initialize a new HySpecNet11k instance.

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

  • split (str) – One of ‘train’, ‘val’, or ‘test’.

  • strategy (str) – Either ‘easy’ for patchwise splitting or ‘hard’ for tilewise splitting.

  • bands (Sequence[str] | None) – Bands to return.

  • 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:

DatasetNotFoundError – If dataset is not found and download is False.

__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, suptitle=None)[source]#

Plot a sample from the dataset.

Parameters:
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.