BioMassters#

class torchgeo.datasets.BioMassters(root='data', split='train', sensors=['S1', 'S2'], as_time_series=False)[source]#

Bases: NonGeoDataset

BioMassters Dataset for Aboveground Biomass prediction.

Dataset intended for Aboveground Biomass (AGB) prediction over Finnish forests based on Sentinel 1 and 2 data with corresponding target AGB mask values generated by Light Detection and Ranging (LiDAR).

Dataset Format:

  • .tif files for Sentinel 1 and 2 data

  • .tif file for pixel wise AGB target mask

  • .csv files for metadata regarding features and targets

Dataset Features:

  • 13,000 target AGB masks of size (256x256px)

  • 12 months of data per target mask

  • Sentinel 1 and Sentinel 2 data for each location

  • Sentinel 1 available for every month

  • Sentinel 2 available for almost every month (not available for every month due to ESA acquisition halt over the region during particular periods)

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

Note

This dataset can be downloaded from Torchgeo Hugging Face Hub.

Added in version 0.5.

__init__(root='data', split='train', sensors=['S1', 'S2'], as_time_series=False)[source]#

Initialize a new instance of BioMassters dataset.

If as_time_series=False (the default), each time step becomes its own sample with the target being shared across multiple samples.

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

  • split (str) – train or test split

  • sensors (Sequence[str]) – which sensors to consider for the sample, Sentinel 1 and/or Sentinel 2 (‘S1’, ‘S2’)

  • as_time_series (bool) – whether or not to return all available time-steps or just a single one for a given target location

Raises:
__getitem__(index)[source]#

Return an index within the dataset.

Parameters:

index (int) – index to return

Returns:

data and labels at that index

Raises:

IndexError – if index is out of range of the dataset

Return type:

dict[str, Any]

__len__()[source]#

Return the length of the dataset.

Returns:

length of the dataset

Return type:

int

plot(sample, show_titles=True, suptitle=None)[source]#

Plot a sample from the dataset.

Parameters:
  • sample (dict[str, Any]) – a sample return 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