SatlasPretrain#

class torchgeo.datasets.SatlasPretrain(root='data', split='train_lowres', good_images='good_images_lowres_all', image_times='image_times', images=('sentinel1', 'sentinel2', 'landsat'), labels=('land_cover',), transforms=None, download=False, checksum=False)[source]#

Bases: NonGeoDataset

SatlasPretrain dataset.

SatlasPretrain is a large-scale pre-training dataset for tasks that involve understanding satellite images. Regularly-updated satellite data is publicly available for much of the Earth through sources such as Sentinel-2 and NAIP, and can inform numerous applications from tackling illegal deforestation to monitoring marine infrastructure. However, developing automatic computer vision systems to parse these images requires a huge amount of manual labeling of training data. By combining over 30 TB of satellite images with 137 label categories, SatlasPretrain serves as an effective pre-training dataset that greatly reduces the effort needed to develop robust models for downstream satellite image applications.

Reference implementation:

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

Added in version 0.7.

Note

This dataset requires the following additional library to be installed:

  • AWS CLI: to download the dataset from AWS.

__init__(root='data', split='train_lowres', good_images='good_images_lowres_all', image_times='image_times', images=('sentinel1', 'sentinel2', 'landsat'), labels=('land_cover',), transforms=None, download=False, checksum=False)[source]#

Initialize a new SatlasPretrain instance.

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

  • split (str) – Metadata split to load.

  • good_images (str) – Metadata mapping between col/row and directory.

  • image_times (str) – Metadata mapping between directory and ISO time.

  • images (Iterable[str]) – List of image products.

  • labels (Iterable[str]) – List of label products.

  • transforms (Callable[[dict[str, Any]], dict[str, Any]] | None) – A function/transform that takes input sample and its target as entry and returns a transformed version.

  • download (bool) – If True, download dataset and store it in the root directory.

  • checksum (bool) – If True, check the MD5 of the downloaded files (may be slow).

Raises:
__len__()[source]#

Return the number of locations in the dataset.

Returns:

Length of the dataset

Return type:

int

__getitem__(index)[source]#

Return an index within the dataset.

Parameters:

index (int) – Index to return.

Returns:

Data and label at that index.

Return type:

dict[str, Any]

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

Plot a sample from the dataset.

Parameters:
  • sample (dict[str, Any]) – A sample returned by __getitem__().

  • show_titles (bool) – Flag indicating whether to show titles above each panel.

  • suptitle (str | None) – Optional string to use as a suptitle.

Returns:

A matplotlib Figure with the rendered sample.

Return type:

Figure

__annotate_func__()#

The type of the None singleton.