LandCover.ai#

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

Bases: LandCoverAIBase, NonGeoDataset

LandCover.ai dataset.

See the abstract LandCoverAIBase class to find out more.

Note

This dataset uses a pre-chipped version of the data available on HuggingFace. The pre-chipped dataset contains the output/ directory with 512x512 image chips and corresponding masks in JPG/PNG format.

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

Initialize a new LandCover.ai dataset instance.

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

  • split (Literal['train', 'val', 'test']) – one of “train”, “val”, or “test”

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

__annotate_func__()[source]#

The type of the None singleton.

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

Bases: LandCoverAI

Subset of LandCoverAI containing only 100 images.

Intended for tutorials and demonstrations, not for benchmarking.

Maintains the same file structure, classes, and train-val-test split.

Added in version 0.7.