DLRSD#

class torchgeo.datasets.DLRSDBase(root='data', transforms=None, download=False, checksum=False)[source]#

Bases: NonGeoDataset

Shared base for DLRSD and DLRSDMultilabel.

The DLRSD dataset is a dataset for dense labeling of remote sensing imagery. It contains 2100 images of size 256x256 pixels across 21 scene categories (100 images per class), and is derived from the UC Merced Land Use Dataset.

Dataset features:

  • 2100 images with 0.3m spatial resolution (256x256 px)

  • three spectral bands - RGB

Dataset classes:

  1. airplane

  2. bare soil

  3. buildings

  4. cars

  5. chaparral

  6. court

  7. dock

  8. field

  9. grass

  10. mobile home

  11. pavement

  12. sand

  13. sea

  14. ship

  15. tanks

  16. trees

  17. water

This base class provides shared dataset assets and download/extract/verify plumbing for both the semantic segmentation and multi-label variants of DLRSD.

Added in version 0.10.

__init__(root='data', transforms=None, download=False, checksum=False)[source]#

Initialize a new DLRSD-style dataset instance.

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

  • transforms (Callable[[dict[str, Tensor]], dict[str, Tensor]] | 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 SHA256 of the downloaded files (may be slow)

Raises:

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

__len__()[source]#

Return the number of data points in the dataset.

Returns:

length of the dataset

Return type:

int

class torchgeo.datasets.DLRSD(root='data', transforms=None, download=False, checksum=False)[source]#

Bases: DLRSDBase

DLRSD semantic segmentation dataset.

The DLRSD variant provides pixel-level semantic segmentation annotations for 17 land cover classes.

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

Added in version 0.10.

__init__(root='data', transforms=None, download=False, checksum=False)[source]#

Initialize a new DLRSD dataset instance.

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

  • transforms (Callable[[dict[str, Tensor]], dict[str, Tensor]] | 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 SHA256 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:

image and mask at that index

Return type:

dict[str, Tensor]

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

Plot a sample from the dataset.

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

  • alpha (float) – opacity with which to render predictions on top of the imagery

Returns:

a matplotlib Figure with the rendered sample

Return type:

Figure

__annotate_func__()[source]#

The type of the None singleton.

class torchgeo.datasets.DLRSDMultilabel(root='data', transforms=None, download=False, checksum=False)[source]#

Bases: DLRSDBase

DLRSD multi-label scene classification dataset.

The DLRSDMultilabel variant provides multi-label scene classification annotations with 17 label classes.

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

Added in version 0.10.

__init__(root='data', transforms=None, download=False, checksum=False)[source]#

Initialize a new DLRSDMultilabel dataset instance.

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

  • transforms (Callable[[dict[str, Tensor]], dict[str, Tensor]] | 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 SHA256 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:

image and label at that index

Return type:

dict[str, Tensor]

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

Plot a sample from the dataset.

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