EuroSAT#

class torchgeo.datasets.EuroSAT(root='data', split='train', bands=('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B09', 'B10', 'B11', 'B12', 'B8A'), transforms=None, download=False, checksum=False)[source]#

Bases: NonGeoClassificationDataset

EuroSAT dataset.

The EuroSAT dataset is based on Sentinel-2 satellite images covering 13 spectral bands and consists of 10 target classes with a total of 27,000 labeled and geo-referenced images.

Dataset format:

  • rasters are 13-channel GeoTiffs

  • labels are values in the range [0,9]

Dataset classes:

  • Annual Crop

  • Forest

  • Herbaceous Vegetation

  • Highway

  • Industrial Buildings

  • Pasture

  • Permanent Crop

  • Residential Buildings

  • River

  • Sea & Lake

This dataset uses the train/val/test splits defined in the “In-domain representation learning for remote sensing” paper:

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

__init__(root='data', split='train', bands=('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B09', 'B10', 'B11', 'B12', 'B8A'), transforms=None, download=False, checksum=False)[source]#

Initialize a new EuroSAT dataset instance.

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

  • split (str) – one of “train”, “val”, or “test”

  • bands (Sequence[str]) – a sequence of band names to load

  • 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:

Added in version 0.3: The bands parameter.

__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

Raises:

RGBBandsMissingError – If bands does not include all RGB bands.

Return type:

Figure

Added in version 0.2.

__annotate_func__()#

The type of the None singleton.

class torchgeo.datasets.EuroSATSpatial(root='data', split='train', bands=('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B09', 'B10', 'B11', 'B12', 'B8A'), transforms=None, download=False, checksum=False)[source]#

Bases: EuroSAT

Overrides the default EuroSAT dataset splits.

Splits the data into training, validation, and test sets based on longitude. The splits are distributed as 60%, 20%, and 20% respectively.

Added in version 0.6.

__annotate_func__()#

The type of the None singleton.

class torchgeo.datasets.EuroSAT100(root='data', split='train', bands=('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B09', 'B10', 'B11', 'B12', 'B8A'), transforms=None, download=False, checksum=False)[source]#

Bases: EuroSAT

Subset of EuroSAT containing only 100 images.

Intended for tutorials and demonstrations, not for benchmarking.

Maintains the same file structure, classes, and train-val-test split. Each class has 10 images (6 train, 2 val, 2 test), for a total of 100 images.

Added in version 0.5.

__annotate_func__()#

The type of the None singleton.