GeoBench Data Modules

Contents

GeoBench Data Modules#

Base Classes#

class geobench_v2.datamodules.GeoBenchClassificationDataModule[source]#

Bases: GeoBenchDataModule

GeoBench Classification DataModule.

By default, will yield a batch of images and their corresponding labels as a dictionary with keys ‘image’ and ‘label’.

__init__(dataset_class, img_size, band_order, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations='default', eval_augmentations='default', pin_memory=False, **kwargs)[source]#

Initialize GeoBench Classification DataModule.

Parameters:
  • dataset_class (Dataset) – Dataset class to use in the DataModule

  • img_size (int) – Desired image input size for the model

  • band_order (Sequence[float | str] | dict[str, Sequence[float | str]]) – band order of the image sample to be returned

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Batch size during evaluation, can usually be larger than batch_size, to speed up evaluation.

  • num_workers (int) – Number of workers for dataloaders

  • collate_fn (Callable | None) – Collate function that can reformat samples to the needs of the model.

  • train_augmentations (Callable | None | str) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Callable | None | str) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – whether to pin memory in dataloaders

  • **kwargs (Any) – Additional keyword arguments passed to dataset_class

define_augmentations()[source]#

Define augmentations for the dataset and task, that are applied on a batch of data.

Augmentations will be applied in on_after_batch_transfer in the LightningDataModule.

setup_image_size_transforms()[source]#

Setup image resizing transforms for train, val, test.

Image resizing and normalization happens on dataset level on individual data samples.

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – batch of data to visualize, if None a batch will be fetched from the dataloader

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

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

class geobench_v2.datamodules.GeoBenchSegmentationDataModule[source]#

Bases: GeoBenchDataModule

GeoBench Segmentation DataModule.

By default, will yield a batch of images and their corresponding masks as a dictionary with keys ‘image’ and ‘mask’.

__init__(dataset_class, img_size, band_order, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations='default', eval_augmentations='default', pin_memory=False, **kwargs)[source]#

Initialize GeoBench Segmentation DataModule.

Parameters:
  • dataset_class (Dataset) – Dataset class to use in the DataModule

  • img_size (int) – Desired image input size for the model

  • band_order (Sequence[float | str] | dict[str, Sequence[float | str]]) – band order of the image sample to be returned

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Batch size during evaluation, can usually be larger than batch_size, to speed up evaluation.

  • num_workers (int) – Number of workers for dataloaders

  • collate_fn (Callable | None) – Collate function that can reformat samples to the needs of the model.

  • train_augmentations (Callable | None | str) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Callable | None | str) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – whether to pin memory in dataloaders

  • **kwargs (Any) – Additional keyword arguments passed to dataset_class

define_augmentations()[source]#

Define augmentations for the dataset and task, that are applied on a batch of data.

Augmentations will be applied in on_after_batch_transfer in the LightningDataModule.

setup_image_size_transforms()[source]#

Setup image resizing transforms for train, val, and test.

Image resizing and normalization happens on the dataset level on individual data samples.

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – batch of data to visualize, if None a batch will be fetched from the dataloader

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

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

class geobench_v2.datamodules.GeoBenchObjectDetectionDataModule[source]#

Bases: GeoBenchDataModule

GeoBench Object Detection DataModule.

By default, will yield a batch of images and their corresponding bounding boxes and labels as a dictionary with keys ‘image’, ‘boxes_xyxy’, and ‘labels’.

__init__(dataset_class, img_size, band_order, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations='default', eval_augmentations='default', pin_memory=False, **kwargs)[source]#

Initialize GeoBench Object Detection DataModule.

Parameters:
  • dataset_class (Dataset) – Dataset class to use in the DataModule

  • img_size (int) – Desired image input size for the model

  • band_order (Sequence[float | str] | dict[str, Sequence[float | str]]) – band order of the image sample to be returned

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Batch size during evaluation, can usually be larger than batch_size, to speed up evaluation.

  • num_workers (int) – Number of workers for dataloaders

  • collate_fn (Callable | None) – Collate function that can reformat samples to the needs of the model.

  • train_augmentations (Callable | None | str) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Callable | None | str) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – whether to pin memory in dataloaders

  • **kwargs (Any) – Additional keyword arguments passed to dataset_class

define_augmentations()[source]#

Define augmentations for the dataset and task, that are applied on a batch of data.

Augmentations will be applied in on_after_batch_transfer in the LightningDataModule.

setup_image_size_transforms()[source]#

Setup image resizing transforms for train, val, test.

Image resizing and normalization happens on dataset level on individual data samples.

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – batch of data to visualize, if None a batch will be fetched from the dataloader

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

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

class geobench_v2.datamodules.GeoBenchDataModule[source]#

Bases: LightningDataModule, ABC

GeoBench DataModule.

__init__(dataset_class, img_size, band_order, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations='default', eval_augmentations='default', pin_memory=False, **kwargs)[source]#

Initialize GeoBench DataModule.

Parameters:
  • dataset_class (Dataset) – Dataset class to use in the DataModule

  • img_size (int) – Desired image input size for the model

  • band_order (Sequence[float | str] | dict[str, Sequence[float | str]]) – band order of the image sample to be returned

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Batch size during evaluation, can usually be larger than batch_size, to speed up evaluation.

  • num_workers (int) – Number of workers for dataloaders

  • collate_fn (Callable | None) – Collate function that can reformat samples to the needs of the model.

  • train_augmentations (Callable | None | str) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should not include normalization, normalization happens on the dataset level for each sample, while geometric and color augmentations will be applied on a batch of data

  • eval_augmentations (Callable | None | str) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should not include normalization, normalization happens on the dataset level for each sample, while geometric and color augme]ntations will be applied on a batch of data

  • pin_memory (bool) – whether to pin memory in dataloaders

  • **kwargs (Any) – Additional keyword arguments passed to dataset_class

prepare_data()[source]#

Download and prepare data, only for distributed setup.

setup(stage=None)[source]#

Setup data for train, val, test.

Parameters:

stage (str | None) – One of ‘fit’, ‘validate’, ‘test’, or ‘predict’.

abstractmethod setup_image_size_transforms()[source]#

Setup image resizing transforms for train, val, test.

Image resizing and normalization happens on dataset level on individual data samples.

abstractmethod load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

abstractmethod visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – batch of data to visualize, if None a batch will be fetched from the dataloader

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

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Any, dict[str, Any]]

abstractmethod define_augmentations()[source]#

Define augmentations for the dataset and task, that are applied on a batch of data.

Augmentations will be applied in on_after_batch_transfer in the LightningDataModule.

visualize_geospatial_distribution(split_column='tortilla:data_split', buffer_degrees=5.0, sample_fraction=None, scale='50m', alpha=0.5, s=10)[source]#

Visualize the geospatial distribution of dataset samples on a map.

Creates a plot showing the geographic locations of samples, colored by dataset split (train, validation, test, extra_test). This helps to understand the spatial distribution and potential geographic biases in the dataset.

Parameters:
  • split_column (str) – Column name in the metadata DataFrame that indicates the dataset split.

  • buffer_degrees (float) – Buffer around the data extent in degrees.

  • sample_fraction (float | None) – Optional fraction of samples to plot (0.0-1.0) for performance with large datasets.

  • scale (Literal['10m', '50m', '110m']) – Scale of cartopy features (e.g., ‘10m’, ‘50m’, ‘110m’).

  • alpha (float) – Transparency of plotted points.

  • s (float) – Size of plotted points.

Returns:

A matplotlib Figure object with the geospatial distribution plot.

Return type:

Figure

abstractmethod visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

train_dataloader()[source]#

Return train dataloader.

Returns:

Train Dataloader

Return type:

DataLoader

val_dataloader()[source]#

Return validation dataloader.

Returns:

Validation Dataloader

Return type:

DataLoader

test_dataloader()[source]#

Return test dataloader.

Returns:

Test Dataloader

Return type:

DataLoader

on_after_batch_transfer(batch, dataloader_idx)[source]#

Apply batch augmentations to the batch after it is transferred to the device.

Parameters:
  • batch (dict[str, Tensor]) – A batch of data that needs to be altered or augmented.

  • dataloader_idx (int) – The index of the dataloader to which the batch belongs.

Returns:

A batch of data.

Return type:

dict[str, Tensor]

BigEarthNetV2#

class geobench_v2.datamodules.GeoBenchBENV2DataModule[source]#

Bases: GeoBenchClassificationDataModule

GeoBench BigEarthNetV2 Data Module.

__init__(img_size=120, band_order={'s1': ('VV', 'VH'), 's2': ('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B09', 'B11', 'B12')}, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench BigEarthNetV2 dataset module.

Parameters:
load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – Optional batch of data. If not provided, a batch will be fetched from the dataloader.

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Raises:

AssertionError – If bands needed for plotting are missing

Return type:

tuple[Any, dict[str, Any]]

visualize_geospatial_distribution(split_column='tortilla:data_split', buffer_degrees=5.0, sample_fraction=None, scale='50m', alpha=0.5, s=0.5)[source]#

Visualize the geospatial distribution of dataset samples on a map.

Parameters:
  • split_column (str) – Column name in the metadata DataFrame that indicates the dataset split.

  • buffer_degrees (float) – Buffer around the data extent in degrees.

  • sample_fraction (float | None) – Optional fraction of samples to plot (0.0-1.0) for performance with large datasets.

  • scale (Literal['10m', '50m', '110m']) – Scale of cartopy features (e.g., ‘10m’, ‘50m’, ‘110m’).

  • alpha (float) – Transparency of plotted points.

  • s (float) – Size of plotted points.

FLAIR2#

class geobench_v2.datamodules.GeoBenchFLAIR2DataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench FLAIR2 Data Module.

__init__(img_size=512, band_order={'aerial': ['red', 'green', 'blue', 'nir'], 'elevation': ['elevation']}, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench FLAIR2 DataModule.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.flair2.GeoBenchFLAIR2

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – A batch of data

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

BioMassters#

class geobench_v2.datamodules.GeoBenchBioMasstersDataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench BioMassters Data Module.

__init__(img_size=256, band_order={'s1': {'VH_asc', 'VH_desc', 'VV_asc', 'VV_desc'}, 's2': {'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B11', 'B12', 'B8A'}}, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench BioMassters DataModule.

Parameters:
load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – Batch of data

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

CaFFe#

class geobench_v2.datamodules.GeoBenchCaFFeDataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench CaFFe Data Module.

__init__(img_size=512, band_order=('gray',), batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench CaFFe dataset module.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.caffe.GeoBenchCaFFe

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_geospatial_distribution(split_column='tortilla:data_split', buffer_degrees=5.0, sample_fraction=None, scale='50m', alpha=0.7, s=5)[source]#

Visualize the geospatial distribution of CaFFe samples on polar projections.

CaFFe dataset contains glacier data from high northern and southern latitudes, focusing on Greenland/Canada in the north and West Antarctica in the south. This creates a split view with zoomed polar projections for each region.

Parameters:
  • split_column (str) – Column name in the metadata DataFrame that indicates the dataset split.

  • buffer_degrees (float) – Buffer around the data extent in degrees.

  • sample_fraction (float | None) – Optional fraction of samples to plot (0.0-1.0) for performance.

  • scale (Literal['10m', '50m', '110m']) – Scale of cartopy features (e.g., ‘10m’, ‘50m’, ‘110m’).

  • alpha (float) – Transparency of plotted points.

  • s (float) – Size of plotted points.

Returns:

A matplotlib Figure object with the geospatial distribution plot.

Return type:

Figure

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Tensor] | None) – Batch of data to visualize

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Figure, dict[str, Tensor]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

CloudSen12#

class geobench_v2.datamodules.GeoBenchCloudSen12DataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench CloudSen12 Data Module.

__init__(img_size=512, band_order=['B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B09', 'B11', 'B12'], batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench CloudSen12 DataModule.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.cloudsen12.GeoBenchCloudSen12

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Tensor] | None) – Batch of data to visualize

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Figure, dict[str, Tensor]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

Dynamic EarthNet#

class geobench_v2.datamodules.GeoBenchDynamicEarthNetDataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench DynamicEarthNet Data Module.

__init__(img_size=512, band_order={'planet': ('b', 'g', 'r', 'nir'), 's2': ('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B10', 'B11', 'B12')}, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench DynamicEarthNet DataModule.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.dynamic_earthnet.GeoBenchDynamicEarthNet

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – Optional batch of data. If not provided, a batch will be fetched from the dataloader.

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Any, dict[str, Any]]

visualize_geospatial_distribution(split_column='tortilla:data_split', buffer_degrees=5.0, sample_fraction=None, scale='50m', alpha=0.8, s=10)[source]#

Visualize the geospatial distribution of dataset samples on a map.

Creates a plot showing the geographic locations of samples, colored by dataset split (train, validation, test, extra_test). This helps to understand the spatial distribution and potential geographic biases in the dataset.

Parameters:
  • split_column (str) – Column name in the metadata DataFrame that indicates the dataset split.

  • buffer_degrees (float) – Buffer around the data extent in degrees.

  • sample_fraction (float | None) – Optional fraction of samples to plot (0.0-1.0) for performance with large datasets.

  • scale (Literal['10m', '50m', '110m']) – Scale of cartopy features (e.g., ‘10m’, ‘50m’, ‘110m’).

  • alpha (float) – Transparency of plotted points

  • s (float) – Size of plotted points.

Returns:

A matplotlib Figure object with the geospatial distribution plot.

Return type:

Figure

setup_image_size_transforms()[source]#

Setup image resizing transforms for train, val, test.

Image resizing and normalization happens on dataset level on individual data samples.

EverWatch#

class geobench_v2.datamodules.GeoBenchEverWatchDataModule[source]#

Bases: GeoBenchObjectDetectionDataModule

GeoBench EverWatch Data Module.

__init__(img_size=512, band_order=('red', 'green', 'blue'), batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=<function everwatch_collate_fn>, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench DOTAV2 dataset module.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.everwatch.GeoBenchEverWatch

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – A batch of data (optional, for debugging purposes)

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

Fields of The World (FoTW)#

class geobench_v2.datamodules.GeoBenchFieldsOfTheWorldDataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench Fields of the World Data Module.

__init__(img_size=256, band_order=('red', 'green', 'blue', 'nir'), batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench Fields of the World DataModule.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for GeoBenchFieldsOfTheWorld.

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data from the Fields of the World dataset.

Parameters:
  • batch (dict[str, Any] | None) – Optional batch of data. If not provided, a batch will be fetched from the dataloader.

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Raises:

AssertionError – If bands needed for plotting are missing

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

KuroSiwo#

class geobench_v2.datamodules.GeoBenchKuroSiwoDataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench KuroSiwo Data Module.

__init__(img_size=224, band_order={'dem': ['dem'], 'sar': ['vv', 'vh']}, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench KuroSiwo dataset module.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.kuro_siwo.GeoBenchKuroSiwo

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – Batch of data to visualize split: One of ‘train’, ‘validation’, ‘test’

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Raises:

AssertionError – If bands needed for plotting are missing

Return type:

tuple[Any, dict[str, Any]]

visualize_geospatial_distribution(split_column='tortilla:data_split', buffer_degrees=5.0, sample_fraction=None, scale='50m', alpha=0.5, s=0.5)[source]#

Visualize the geospatial distribution of dataset samples on a map.

Note: This dataset does not provide geolocation information; returns None.

PASTIS#

class geobench_v2.datamodules.GeoBenchPASTISDataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench PASIS Data Module.

__init__(img_size=128, band_order={'s1_asc': ('VV_asc', 'VH_asc', 'VV/VH_asc'), 's1_desc': ('VV_desc', 'VH_desc', 'VV/VH_desc'), 's2': ('B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B11', 'B12')}, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench PASIS DataModule.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for:class:~geobench_v2.datasets.pastis.GeoBenchPASTIS.

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – Optional batch of data. If not provided, a batch will be fetched from the dataloader

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Raises:

AssertionError – If bands needed for plotting are missing

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

PASTIS Panoptic

class geobench_v2.datamodules.GeoBenchPASTISPanopticDataModule[source]#

Bases: GeoBenchObjectDetectionDataModule

GeoBench PASTIS Data Module for Panoptic Segmentation.

__init__(img_size=128, band_order={'s1_asc': ('VV_asc', 'VH_asc', 'VV/VH_asc'), 's1_desc': ('VV_desc', 'VH_desc', 'VV/VH_desc'), 's2': ('B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B11', 'B12')}, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench PASIS DataModule.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments to GeoBenchPASTIS.

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – Optional batch of data. If not provided, a batch will be fetched from the dataloader

  • split (str) – One of ‘train’, ‘validation’, ‘test’

  • n_samples – number of samples to plot

Returns:

The matplotlib figure and the batch of data

Raises:

AssertionError – If bands needed for plotting are missing

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

SpaceNet2#

class geobench_v2.datamodules.GeoBenchSpaceNet2DataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench SpaceNet2 Data Module.

__init__(img_size=512, band_order={'pan': ('pan',), 'worldview': ('coastal', 'blue', 'green', 'yellow', 'red', 'red_edge', 'nir1', 'nir2')}, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench SpaceNet2 dataset module.

Parameters:
  • img_size (int) – Image size, created patches are of size 512

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.spacenet2.GeoBenchSpaceNet2

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – Optional batch of data to visualize. If not provided, a batch will be fetched from the dataloader.

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Raises:

AssertionError – If bands needed for plotting are missing

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

SpaceNet6#

class geobench_v2.datamodules.GeoBenchSpaceNet6DataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench SpaceNet6 Data Module.

__init__(img_size=450, band_order={'rgbn': ('red', 'green', 'blue', 'nir'), 'sar': ('hh', 'hv', 'vv', 'vh')}, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench SpaceNet6 dataset module.

Parameters:
  • img_size (int) – Image size, in geobench version patches of 450

  • band_order (dict[str, Sequence[float | str]]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.spacenet6.GeoBenchSpaceNet6

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – A batch of data

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Raises:

AssertionError – If bands needed for plotting are missing

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

SpaceNet7#

class geobench_v2.datamodules.GeoBenchSpaceNet7DataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench SpaceNet7 Data Module.

__init__(img_size=512, band_order=('red', 'green', 'blue'), batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench SpaceNet7 dataset module.

Parameters:
  • img_size (int) – Image size, created patches are of size 512

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.spacenet7.GeoBenchSpaceNet7

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – Optional batch of data to visualize. If not provided, a batch will be fetched from the dataloader.

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Raises:

AssertionError – If bands needed for plotting are missing

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

SpaceNet8#

class geobench_v2.datamodules.GeoBenchSpaceNet8DataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench SpaceNet8 Data Module.

__init__(img_size=512, band_order=('red', 'green', 'blue'), batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench SpaceNet8 dataset module.

Parameters:
  • img_size (int) – Image size, created patches are of size 512

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during training

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for the dataset class

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – Optional batch of data. If not provided, a batch will be fetched from the dataloader.

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

TreeSatAI#

class geobench_v2.datamodules.GeoBenchTreeSatAIDataModule[source]#

Bases: GeoBenchClassificationDataModule

GeoBench TreeSatAI Data Module.

__init__(img_size=304, band_order={'aerial': ['red', 'green', 'blue', 'nir'], 's1': ['vv', 'vh', 'vv/vh'], 's2': ['B02', 'B03', 'B04', 'B08', 'B05', 'B06', 'B07', 'B8A', 'B11', 'B12', 'B01', 'B09']}, batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench TreeSatAI dataset module.

Parameters:
  • img_size (int) – Image size originally 304

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Training augmentations

  • eval_augmentations (Module | None) – Evaluation augmentations

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.treesatai.GeoBenchTreeSatAI

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_geospatial_distribution(split_column='tortilla:data_split', buffer_degrees=2.0, scale='50m', alpha=0.5, s=0.5)[source]#

Visualize the geospatial distribution of dataset samples on a map.

Creates a plot showing the geographic locations of samples, colored by dataset split (train, validation, test). This helps to understand the spatial distribution and potential geographic biases in the dataset.

Parameters:
  • split_column – Column name in the metadata DataFrame that indicates the dataset split.

  • buffer_degrees (float) – Buffer around the data extent in degrees

  • sample_fraction – Fraction of samples to plot (0.0-1.0) for performance with large datasets

  • scale (Literal['10m', '50m', '110m']) – Scale of cartopy features (e.g., ‘10m’, ‘50m’, ‘110m’)

  • alpha (float) – Transparency of plotted points

  • s (float) – Size of plotted points

visualize_batch(split='train')[source]#

Visualize a batch of data.

Parameters:

split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Raises:

AssertionError – If bands needed for plotting are missing

Return type:

tuple[Figure, dict[str, Tensor]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

Burn Scars#

class geobench_v2.datamodules.GeoBenchBurnScarsDataModule[source]#

Bases: GeoBenchSegmentationDataModule

GeoBench Burn Scars Data Module.

__init__(img_size=512, band_order=['B02', 'B03', 'B04', 'B8A', 'B11', 'B12'], batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=None, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench Burn Scars dataset module.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | str]) – The order of bands to return in the sample

  • batch_size (int) – Batch size during

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.burn_scars.GeoBenchBurnScars

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Tensor] | None) – Batch of data to visualize

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Figure, dict[str, Tensor]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

NZCattle#

class geobench_v2.datamodules.GeoBenchNZCattleDataModule[source]#

Bases: GeoBenchObjectDetectionDataModule

GeoBench nzCattle Data Module.

__init__(img_size=512, band_order=('red', 'green', 'blue'), batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=<function nzcattle_collate_fn>, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench nzCattle dataset module.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | 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.

  • batch_size (int) – Batch size during

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.nzcattle.GeoBenchNZCattle

visualize_batch(batch=None, split='train')[source]#

Visualize a batch of data.

Parameters:
  • batch (dict[str, Any] | None) – A batch of data (optional)

  • split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Any, dict[str, Any]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

Substation#

class geobench_v2.datamodules.GeoBenchSubstationDataModule[source]#

Bases: GeoBenchObjectDetectionDataModule

GeoBench Substation Data Module.

__init__(img_size=228, band_order=['B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B09', 'B10', 'B11', 'B12'], batch_size=32, eval_batch_size=64, num_workers=0, collate_fn=<function substation_collate_fn>, train_augmentations=None, eval_augmentations=None, pin_memory=False, **kwargs)[source]#

Initialize GeoBench Substation dataset module.

Parameters:
  • img_size (int) – Image size

  • band_order (Sequence[float | 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.

  • batch_size (int) – Batch size during

  • eval_batch_size (int) – Evaluation batch size

  • num_workers (int) – Number of workers

  • collate_fn (Callable | None) – Collate function

  • train_augmentations (Module | None) – Transforms/Augmentations to apply during training, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • eval_augmentations (Module | None) – Transforms/Augmentations to apply during evaluation, they will be applied at the sample level and should include normalization. See define_augmentations() for the default transformation.

  • pin_memory (bool) – Pin memory

  • **kwargs (Any) – Additional keyword arguments for geobench_v2.datasets.substation.GeoBenchSubstation

load_metadata()[source]#

Load metadata file.

Returns:

pandas DataFrame with metadata.

Return type:

DataFrame

visualize_batch(split='train')[source]#

Visualize a batch of data.

Parameters:

split (str) – One of ‘train’, ‘validation’, ‘test’

Returns:

The matplotlib figure and the batch of data

Return type:

tuple[Figure, dict[str, Tensor]]

visualize_geolocation_distribution()[source]#

Visualize the geolocation distribution of the dataset.