GeoBench Datasets

Contents

GeoBench Datasets#

BigEarthNetV2#

class geobench_v2.datasets.GeoBenchBENV2[source]#

Bases: GeoBenchBaseDataset

GeoBench Version of BigEarthNet V2 Dataset.

Multi-label land cover classification dataset using Sentinel-1 SAR (VV, VH) and Sentinel-2 optical (12 bands) imagery, with CORINE Land Cover-based hierarchical multi-label annotations.

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

__init__(root, split, rename_modalities=None, band_order={'s2': ['B04', 'B03', 'B02']}, data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, metadata=None, return_stacked_image=False, download=False)[source]#

Initialize Big Earth Net V2 Dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (Literal['train', 'val', 'validation', 'test']) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (dict[str, Sequence[float | str]]) – The order of bands to return, defaults to [‘B04’, ‘B03’, ‘B02’], if one would specify [‘B04’, ‘B03’, ‘B02], the dataset would return the red, green, and blue bands. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – Transforms to apply to the data

  • metadata (Sequence[str] | None) – metadata names to be returned under specified keys as part of the sample in the __getitem__ method. If None, no metadata is returned.

  • return_stacked_image (bool) – If True, return the stacked modalities across channel dimension instead of the individual modalities.

  • download (bool) – Whether to download the dataset

  • rename_modalities (dict | None) – dictionary with information to rename modalities in output e.g. {image: {s1: S1RTC, s2: S2L2A}}

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

FLAIR2#

class geobench_v2.datasets.GeoBenchFLAIR2[source]#

Bases: GeoBenchBaseDataset

GeoBench version of FLAIR 2 dataset.

Land cover semantic segmentation dataset using aerial RGB+NIR, DEM, and Sentinel-2 imagery, with 13-class pixel-level labels.

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

__init__(root, split, band_order={'aerial': ['red', 'green', 'blue', 'nir'], 'elevation': ['elevation']}, data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, metadata=None, download=False)[source]#

Initialize FLAIR 2 dataset.

Parameters:
  • root – Path to the dataset root directory

  • split (Literal['train', 'val', 'validation', 'test']) – The dataset split, supports ‘train’, ‘test’

  • band_order (Mapping[str, list[str]]) – The order of bands to return, defaults to [‘r’, ‘g’, ‘b’], if one would specify [‘r’, ‘g’, ‘b’, ‘nir’], the dataset would return images with 4 channels

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – The transforms to apply to the data, defaults to None

  • metadata (Sequence[str] | None) – metadata names to be returned as part of the sample in the __getitem__ method. If None, no metadata is returned.

  • download (bool) – Whether to download the dataset

Raises:

AssertionError – If split is not in the splits

__getitem__(idx)[source]#

Return an index within the dataset.

Parameters:

idx (int) – index to return

Returns:

data and label at that index

Return type:

dict[str, Tensor]

BioMassters#

class geobench_v2.datasets.GeoBenchBioMassters[source]#

Bases: GeoBenchBaseDataset

GeoBench version of BioMassters dataset.

Biomass regression dataset using Sentinel-1 SAR and Sentinel-2 optical imagery, with reference pixel wise biomass annotation from LiDAR and field data.

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

__init__(root, split, band_order={'s1': ['VV_asc', 'VH_asc'], 's2': ['B04', 'B03', 'B02', 'B08']}, rename_modalities=None, data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, metadata=None, num_time_steps=1, download=False, return_stacked_image=False)[source]#

Initialize BioMassters dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (str) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (dict[str, Sequence[str]]) – The order of bands to return, defaults to [‘red’, ‘green’, ‘blue’, ‘nir’], if one would specify [‘red’, ‘green’, ‘blue’, ‘nir’, ‘nir’], the dataset would return images with 5 channels in that order. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – The transforms to apply to the data, defaults to None.

  • metadata (Sequence[str] | None) – metadata names to be returned under specified keys as part of the sample in the __getitem__ method. If None, no metadata is returned.

  • num_time_steps (int) – Number of last time steps to include in the dataset, maximum is 12, for S2 missing time steps are filled with zeros.

  • download (bool) – Whether to download the dataset

  • rename_modalities (dict | None) – dictionary with information to rename modalities in output e.g. {image: {sar: S1RTC, rgbn: S2L2A}}

  • return_stacked_image (bool) – If True, return the stacked modalities across channel dimension instead of the individual modalities.

  • **kwargs – Additional keyword arguments passed to torchgeo.datasets.BioMassters

Raises:

AssertionError – If the number of time steps is greater than 12

__getitem__(idx)[source]#

Return an index within the dataset.

Parameters:

idx (int) – index to return

Returns:

data and label at that index

Return type:

dict[str, Tensor]

If num_time_steps is 1, the dataset will return image samples with shape [C, H, W], if num_time_steps is greater than 1, the dataset will return image samples with shape [C, T, H, W], where T is the number of time steps.

CaFFe#

class geobench_v2.datasets.GeoBenchCaFFe[source]#

Bases: GeoBenchBaseDataset

GeoBench version of Caffe dataset.

lacier calving front segmentation dataset using Sentinel-1 SAR imagery, with annotated calving front masks.

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

__init__(root, split='train', band_order=('gray', ), data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, metadata=None, download=False)[source]#

Initialize Caffe dataset.

Parameters:
  • root – Path to the dataset root directory

  • split – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (Sequence[float | str]) – The order of bands to return, defaults to [‘gray’], if one would specify [‘gray’, ‘gray’, ‘gray], the dataset would return the gray band three times.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – The transforms to apply to the data, defaults to None.

  • metadata (Sequence[str] | None) – The metadata to return, defaults to None.

  • download (bool) – Whether to download the dataset, defaults to False.

Raises:

AssertionError – If split is not in the splits

__getitem__(idx)[source]#

Return an index within the dataset.

Parameters:

idx (int) – index to return

Returns:

data and label at that index

Return type:

dict[str, Tensor]

CloudSen12#

class geobench_v2.datasets.GeoBenchCloudSen12[source]#

Bases: GeoBenchBaseDataset

GeoBench version of CloudSen12 dataset.

Cloud and shadow segmentation dataset using Sentinel-2 optical imagery, with pixel-level cloud and shadow masks.

  1. clear: Pixels without cloud and cloud shadow contamination.

  2. thick cloud: Opaque clouds that block all reflected light from Earth’s surface.

  3. thin cloud: Semitransparent clouds that alter the surface spectral signal but still allow recognition of the background.

  4. cloud shadow: Dark pixels where light is occluded by thick or thin clouds.

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

__init__(root, split='train', band_order=['B04', 'B03', 'B02'], data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, metadata=None, download=False)[source]#

Initialize a CloudSen12 dataset instance.

Parameters:
  • root – Path to the dataset root directory

  • split (Literal['train', 'validation', 'test']) – The dataset split, supports ‘train’, ‘test’

  • band_order (Sequence[float | str]) – The order of bands to return, defaults to [‘r’, ‘g’, ‘b’], if one would specify [‘r’, ‘g’, ‘b’, ‘nir’], the dataset would return images with 4 channels

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – Image resize transform on sample level

  • metadata (Sequence[str] | None) – metadata names to be returned under specified keys as part of the sample in the __getitem__ method. If None, no metadata is returned.

  • download (bool) – Whether to download the dataset

Raises:

AssertionError – If split is not in the splits

__getitem__(idx)[source]#

Return the sample_row at the given index.

Parameters:

idx (int) – Index of the sample_row to return

Returns:

dict containing the sample_row data

Return type:

dict[str, Tensor]

Dynamic EarthNet#

class geobench_v2.datasets.GeoBenchDynamicEarthNet[source]#

Bases: GeoBenchBaseDataset

GeoBench version of DynamicEarthNet dataset.

ulti-temporal land cover segmentation dataset using Sentinel-2 and PlanetScope imagery, with 7-class semantic segmentation labels.

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

__init__(root, split, band_order={'planet': ['red', 'green', 'blue', 'nir']}, data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, metadata=None, temporal_setting='single', return_stacked_image=False, download=False)[source]#

Initialize the dataset.

Parameters:
  • root (Path) – Root directory where the dataset can be found

  • split (str) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (dict[str, Sequence[float | str]]) – Band order for the dataset

  • data_normalizer (type[Module]) – Data normalizer

  • transforms (Module | None) – A composition of transformations to apply to the data

  • metadata (Sequence[str] | None) – metadata names to be returned as part of the sample in the __getitem__ method. If None, no metadata is returned.

  • temporal_setting (Literal['single', 'daily', 'weekly']) – The temporal setting to use, either ‘single’, ‘daily’ or ‘weekly’

  • return_stacked_image (bool) – If True, return the stacked modalities across channel dimension instead of the individual modalities.

  • download (bool) – Whether to download the dataset

__getitem__(idx)[source]#

Return an index within the dataset.

Parameters:

idx (int) – index to return

Returns:

data and label at that index

Return type:

dict[str, Tensor]

EverWatch#

class geobench_v2.datasets.GeoBenchEverWatch[source]#

Bases: GeoBenchBaseDataset

GeoBench version of EverWatch dataset.

Bird object detection dataset using high-resolution aerial RGB imagery, with bounding box annotations for multiple bird species.

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

__init__(root, split, band_order=('red', 'green', 'blue'), data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, metadata=None, download=False)[source]#

Initialize EverWatch dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (Literal['train', 'val', 'validation', 'test']) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (Sequence[str]) – The order of bands to return, defaults to [‘red’, ‘green’, ‘blue’], if one would specify [‘red’, ‘green’, ‘blue’, ‘blue’], the dataset would return images with 4 channels in that order. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – The transforms to apply to the data, defaults to None.

  • metadata (Sequence[str] | None) – The metadata to return, defaults to None. If None, no metadata is returned.

  • download (bool) – Whether to download the dataset

__getitem__(idx)[source]#

Return an index within the dataset.

Parameters:

idx (int) – index to return

Returns:

data and label at that index

Return type:

dict[str, Tensor]

Fields of The World (FoTW)#

class geobench_v2.datasets.GeoBenchFieldsOfTheWorld[source]#

Bases: GeoBenchBaseDataset

Fields of the World Dataset with enhanced functionality.

Field boundary segmentation dataset using multi-temporal Sentinel-2 imagery, with field mask annotations across diverse regions.

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

__init__(root, split, band_order=['red', 'green', 'blue', 'nir'], data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, label_type='semantic_seg', transforms=None, metadata=None, return_stacked_image=False, return_window=['win_a', 'win_b'], download=False)[source]#

Initialize Fields of the World Dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (str) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (Sequence[str | float]) – The order of bands to return, defaults to [‘red’, ‘green’, ‘blue’, ‘nir’], if one would specify [‘red’, ‘green’, ‘blue’, ‘nir’, ‘nir’], the dataset would return images with 5 channels in that order. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • label_type (Literal['instance_seg', 'semantic_seg']) – The type of label to return, supports ‘instance_seg’ or ‘semantic_seg’

  • transforms (Module | None) – The transforms to apply to the data, defaults to None

  • return_stacked_image (bool) – if true, returns a single image tensor with all modalities stacked in band_order

  • return_window (Sequence[str]) – select which windows to return

  • metadata (Sequence[str] | None) – metadata names to be returned under specified keys as part of the sample in the __getitem__ method. If None, no metadata is returned.

  • download (bool) – Whether to download the dataset

__getitem__(idx)[source]#

Return the image and mask at the given index.

Parameters:

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

Returns:

a dict containing the image and mask

Return type:

dict

KuroSiwo#

class geobench_v2.datasets.GeoBenchKuroSiwo[source]#

Bases: GeoBenchBaseDataset

GeoBench version of Kuro Siwo dataset.

Flood segmentation dataset using Sentinel-1 SAR, DEM, and slope data, with 4-class flood extent masks.

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

__init__(root, split, band_order={'dem': ['dem'], 'sar': ['vv', 'vh']}, data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, return_stacked_image=False, time_step=['pre_1', 'pre_2', 'post'], download=False)[source]#

Initialize Kuro Siwo Dataset.

Parameters:
  • root (str) – Path to dataset

  • split (Literal['train', 'val', 'test']) – Split of dataset

  • band_order (dict[str, Sequence[str]]) – Band order for dataset

  • data_normalizer (type[Module]) – Data normalizer

  • transforms (type[Module]) – Data transforms

  • return_stacked_image (bool) – if true, returns a single image tensor with all modalities stacked in band_order

  • time_step (Sequence[str]) – Time step for dataset

  • download (bool) – whether to download the dataset

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

PASTIS#

class geobench_v2.datasets.GeoBenchPASTIS[source]#

Bases: GeoBenchBaseDataset

GeoBench version of PASTIS dataset.

Crop type and parcel segmentation dataset using multi-temporal Sentinel-1 and Sentinel-2 imagery, with 19-class parcel-level labels.

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

__init__(root, split, rename_modalities=None, band_order={'s2': ['B04', 'B03', 'B02']}, data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, num_time_steps=1, transforms=None, metadata=None, label_type='semantic_seg', return_stacked_image=False, temporal_aggregation=None, temporal_output_format='CTHW', download=False)[source]#

Initialize PASTIS Dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (Literal['train', 'val', 'validation', 'test']) – The dataset split, supports ‘train’, ‘val’, ‘test’

  • band_order (dict[str, Sequence[float | str]]) – The order of bands to return, defaults to [‘red’, ‘green’, ‘blue’, ‘nir’], if one would specify [‘red’, ‘green’, ‘blue’, ‘nir’, ‘nir’], the dataset would return images with 5 channels in that order. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • num_time_steps (int) – The number of last time steps to return, defaults to 1, which returns the last time step. if set to 10, the latest 10 time steps will be returned. If a time series has fewer time steps than specified, it will be padded with zeros. A value of 1 will return a [C, H, W] tensor, while a value of 10 will return a [T, C, H, W] tensor.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – The transforms to apply to the data, defaults to None

  • metadata (Sequence[str] | None) – metadata names to be returned under specified keys as part of the sample in the __getitem__ method. If None, no metadata is returned.

  • label_type (Literal['instance_seg', 'semantic_seg']) – The type of label to return, either ‘instance_seg’ or ‘semantic_seg’

  • return_stacked_image (bool) – if true, returns a single image tensor with all modalities stacked in band_order

  • rename_modalities (dict | None) – dictionary with information to rename modalities in output e.g. {image: {sar: S1RTC, rgbn: S2L2A}}

  • download (bool) – Whether to download the dataset

  • temporal_aggregation (Literal['mean', 'median']) – whether apply temporal aggregation [mean, median]

  • temporal_output_format (Literal['TCHW', 'CTHW']) – what temporal format the data should be in [TCHW, CTHW]

Raises:

AssertionError – If an invalid split is specified

__len__()[source]#

Return the length of the dataset.

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

validate_band_order(band_order)[source]#

Validate band order configuration for PASTIS time-series data.

For PASTIS, we need to ensure that bands in a sequence belong to the same modality, since different modalities have different time-series lengths.

Parameters:

band_order (Sequence[str | float] | dict[str, Sequence[str | float]]) – Band order specification

Returns:

Validated and resolved band order

Raises:

ValueError – If bands from different modalities are mixed in a sequence

Return type:

list[str | float] | dict[str, list[str | float]]

SpaceNet2#

class geobench_v2.datasets.GeoBenchSpaceNet2[source]#

Bases: GeoBenchBaseDataset

GeoBench version of SpaceNet2 dataset.

Building footprint segmentation dataset using high-resolution optical imagery, with binary building masks.

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

__init__(root, split, band_order={'pan': ('pan', ), 'worldview': ('coastal', 'blue', 'green', 'yellow', 'red', 'red_edge', 'nir1', 'nir2')}, data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, label_type='semantic_seg', transforms=None, metadata=None, return_stacked_image=False, download=False)[source]#

Initialize SpaceNet2 dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (Literal['train', 'val', 'validation', 'test']) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • label_type (Literal['instance_seg', 'semantic_seg']) – The type of label to return, supports ‘instance_seg’ or ‘semantic_seg’

  • band_order (list[str]) – The order of bands to return, defaults to [‘red’, ‘green’, ‘blue’], if one would specify [‘red’, ‘green’, ‘blue’, ‘blue’, ‘blue’], the dataset would return images with 5 channels in that order. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • label_type – The type of label to return, supports ‘instance_seg’ or ‘semantic_seg’

  • transforms (Module | None) – The transforms to apply to the data, defaults to None

  • metadata (Sequence[str] | None) – metadata names to be returned as part of the sample in the __getitem__ method. If None, no metadata is returned.

  • return_stacked_image (bool) – if true, returns a single image tensor with all modalities stacked in band_order

  • download (bool) – Whether to download the dataset

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

SpaceNet6#

class geobench_v2.datasets.GeoBenchSpaceNet6[source]#

Bases: GeoBenchBaseDataset

GeoBench version of SpaceNet6 dataset.

__init__(root, split, rename_modalities=None, band_order={'rgbn': ('red', 'green', 'blue', 'nir'), 'sar': ('hh', 'hv', 'vv', 'vh')}, data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, return_stacked_image=False, metadata=None, download=False)[source]#

Initialize SpaceNet6 dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (Literal['train', 'val', 'validation', 'test']) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (Sequence[str]) – The order of bands to return, defaults to [‘red’, ‘green’, ‘blue’, ‘nir’], if one would specify [‘red’, ‘green’, ‘blue’, ‘nir’, ‘nir’], the dataset would return images with 5 channels in that order. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – image transformations to apply to the data, defaults to None

  • metadata (Sequence[str] | None) – metadata names to be returned as part of the sample in the

  • return_stacked_image (bool) – if true, returns a single image tensor with all modalities stacked in band_order

  • rename_modalities (dict | None) – dictionary with information to rename modalities in output e.g. {image: {sar: S1RTC, rgbn: S2L2A}}

  • transforms – image transformations to apply to the data, defaults to None

  • download (bool) – Whether to download the dataset

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

SpaceNet7#

class geobench_v2.datasets.GeoBenchSpaceNet7[source]#

Bases: GeoBenchBaseDataset

GeoBench version of SpaceNet7 dataset.

Multi-temporal building segmentation and tracking dataset using PlanetScope imagery, with fine grained building footprint masks.

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

__init__(root, split, band_order=('red', 'green', 'blue'), data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, metadata=None, download=False)[source]#

Initialize SpaceNet7 dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (Literal['train', 'val', 'validation', 'test']) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (list[str]) – The order of bands to return, defaults to [‘red’, ‘green’, ‘blue’], if one would specify [‘red’, ‘green’, ‘blue’, ‘blue’, ‘blue’], the dataset would return images with 5 channels in that order. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer,

  • transforms (Module) – The transforms to apply to the data, defaults to None

  • metadata (Sequence[str] | None) – metadata names to be returned as part of the sample in the __getitem__ method. If None, no metadata is returned.

  • download (bool) – Whether to download the dataset

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

SpaceNet8#

class geobench_v2.datasets.GeoBenchSpaceNet8[source]#

Bases: GeoBenchBaseDataset

GeoBench version of SpaceNet8 dataset.

__init__(root, split, band_order=('red', 'green', 'blue'), data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, metadata=None, return_stacked_image=False, time_step=['pre', 'post'], download=False)[source]#

Initialize SpaceNet8 dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (Literal['train', 'val', 'validation', 'test']) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (list[str]) – The order of bands to return, defaults to [‘red’, ‘green’, ‘blue’], if one would specify [‘red’, ‘green’, ‘blue’, ‘blue’, ‘blue’], the dataset would return images with 5 channels in that order. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer,

  • transforms (Module | None) – The transforms to apply to the data, defaults to None

  • metadata (Sequence[str] | None) – metadata names to be returned as part of the sample in the __getitem__ method. If None, no metadata is returned.

  • time_step (Sequence[str]) – list of image time steps to include from the list [“pre”, “post”]

  • return_stacked_image (bool) – if true, returns a single image tensor with all modalities stacked in band_order

  • download (bool) – Whether to download the dataset

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

TreeSatAI#

class geobench_v2.datasets.GeoBenchTreeSatAI[source]#

Bases: GeoBenchBaseDataset

GeoBench version of TreeSatAI dataset.

Tree species classification dataset using multi-temporal Sentinel-2 imagery, with multi-class 13-class species labels.

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

__init__(root, rename_modalities=None, split={'aerial': ['red', 'green', 'blue', 'nir']}, band_order={'aerial': ['r', 'g', 'b']}, data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, metadata=None, include_ts=False, num_time_steps=1, return_stacked_image=False, download=False)[source]#

Initialize TreeSatAI dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (dict[str, list[str]]) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (dict[str, Sequence[str]]) – The order of bands to return, defaults to [‘red’, ‘green’, ‘blue’, ‘nir’], if one would specify [‘red’, ‘green’, ‘blue’, ‘nir’, ‘nir’], the dataset would return images with 5 channels in that order. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – image transformations to apply to the data, defaults to None

  • metadata (Sequence[str] | None) – metadata names to be returned as part of the sample in the __getitem__ method. If None, no metadata is returned.

  • include_ts (bool) – whether or not to return the time series in data loading

  • num_time_steps (int) – number of last time steps to return in the ts data

  • return_stacked_image (bool) – if true, returns a single image tensor with all modalities stacked in band_order

  • rename_modalities (dict | None) – dictionary with information to rename modalities in output e.g. {image: {s1: S1RTC, s2: S2L2A}}

  • download (bool) – Whether to download the dataset

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

Burn Scars#

class geobench_v2.datasets.GeoBenchBurnScars[source]#

Bases: GeoBenchBaseDataset

GeoBench Burn Scars dataset.

Burned area segmentation dataset using Harmonized Landsat-Sentinel (HLS: Landsat 8/9 + Sentinel-2) imagery, with multi-source burn scar annotations.

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

__init__(root, split='train', band_order=['B02', 'B03', 'B04', 'B8A', 'B11', 'B12'], data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, metadata=None, download=False)[source]#

Initialize Burn Scars dataset.

Parameters:
  • root – Path to the dataset root directory

  • split – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (Sequence[float | str]) – The order of bands to return, defaults to [‘gray’], if one would specify [‘gray’, ‘gray’, ‘gray], the dataset would return the gray band three times.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to data_util.ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – The transforms to apply to the data, defaults to None.

  • metadata (Sequence[str] | None) – The metadata to return, defaults to None.

  • download (bool) – Whether to download the dataset, defaults to False.

Raises:

AssertionError – If split is not in the splits

__getitem__(idx)[source]#

Return an index within the dataset.

Parameters:

idx (int) – index to return

Returns:

data and label at that index

Return type:

dict[str, Tensor]

NZCattle#

class geobench_v2.datasets.GeoBenchNZCattle[source]#

Bases: GeoBenchBaseDataset

GeoBench version of NzCattle dataset.

__init__(root, split, band_order=('red', 'green', 'blue'), data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, download=False)[source]#

Initialize nzCattle dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (Literal['train', 'val', 'validation', 'test']) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (Sequence[str]) – The order of bands to return, defaults to [‘red’, ‘green’, ‘blue’], if one would specify [‘red’, ‘green’, ‘blue’, ‘blue’], the dataset would return images with 4 channels in that order. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – image transformations to apply to the data, defaults to None

  • download (bool) – Whether to download the dataset

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

Substation#

class geobench_v2.datasets.GeoBenchSubstation[source]#

Bases: GeoBenchBaseDataset

GeoBench version Substation dataset.

__init__(root, split, band_order=['B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B09', 'B10', 'B11', 'B12'], data_normalizer=<class 'geobench_v2.datasets.normalization.ZScoreNormalizer'>, transforms=None, download=False)[source]#

Initialize Substation dataset.

Parameters:
  • root (Path) – Path to the dataset root directory

  • split (str) – The dataset split, supports ‘train’, ‘validation’, ‘test’

  • band_order (list[str]) – The order of bands to return, defaults to [‘red’, ‘green’, ‘blue’], if one would specify [‘red’, ‘green’, ‘blue’, ‘blue’], the dataset would return images with 4 channels in that order. This is useful for models that expect a certain band order, or test the impact of band order on model performance.

  • data_normalizer (type[Module]) – The data normalizer to apply to the data, defaults to ZScoreNormalizer, which applies z-score normalization to each band.

  • transforms (Module | None) – image transformations to apply to the data, defaults to None

  • download (bool) – Whether to download the dataset

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