PASTIS#

class torchgeo.datasets.PASTIS(root='data', folds=(1, 2, 3, 4, 5), bands='s2', mode='semantic', transforms=None, download=False, checksum=False)[source]#

Bases: NonGeoDataset

PASTIS dataset.

The PASTIS dataset is a dataset for time-series panoptic segmentation of agricultural parcels.

Dataset features:

  • support for the original PASTIS and PASTIS-R versions of the dataset

  • 2,433 time-series with 10 m per pixel resolution (128x128 px)

  • 18 crop categories, 1 background category, 1 void category

  • semantic and instance annotations

  • 3 Sentinel-1 Ascending bands

  • 3 Sentinel-1 Descending bands

  • 10 Sentinel-2 L2A multispectral bands

Dataset format:

  • time-series and annotations are in numpy format (.npy)

Dataset classes:

  1. Background

  2. Meadow

  3. Soft Winter Wheat

  4. Corn

  5. Winter Barley

  6. Winter Rapeseed

  7. Spring Barley

  8. Sunflower

  9. Grapevine

  10. Beet

  11. Winter Triticale

  12. Winter Durum Wheat

  13. Fruits Vegetables Flowers

  14. Potatoes

  15. Leguminous Fodder

  16. Soybeans

  17. Orchard

  18. Mixed Cereal

  19. Sorghum

  20. Void Label

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

Added in version 0.5.

__init__(root='data', folds=(1, 2, 3, 4, 5), bands='s2', mode='semantic', transforms=None, download=False, checksum=False)[source]#

Initialize a new PASTIS dataset instance.

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

  • folds (Sequence[int]) – a sequence of integers from 0 to 4 specifying which of the five dataset folds to include

  • bands (str) – load Sentinel-1 ascending path data (s1a), Sentinel-1 descending path data (s1d), or Sentinel-2 data (s2)

  • mode (str) – load semantic (semantic) or instance (instance) annotations

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

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

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

Raises:

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

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

__len__()[source]#

Return the number of data points in 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 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.