EnviroAtlas#

class torchgeo.datasets.EnviroAtlas(root='data', splits=['pittsburgh_pa-2010_1m-train'], layers=['naip', 'prior'], transforms=None, prior_as_input=False, cache=True, download=False, checksum=False)[source]#

Bases: GeoDataset

EnviroAtlas dataset covering four cities with prior and weak input data layers.

The EnviroAtlas dataset contains NAIP aerial imagery, NLCD land cover labels, OpenStreetMap roads, water, waterways, and waterbodies, Microsoft building footprint labels, high-resolution land cover labels from the EPA EnviroAtlas dataset, and high-resolution land cover prior layers.

This dataset was organized to accompany the 2022 paper, “Resolving label uncertainty with implicit generative models”. More details can be found at estherrolf/implicit-posterior.

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

Added in version 0.3.

raw_enviroatlas_to_idx_map: NDArray[uint8] = array([ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,         0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,         0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,         0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,         0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  8,  0,  0,         0,  0,  0,  0,  0,  0,  9, 10], dtype=uint8)#
__init__(root='data', splits=['pittsburgh_pa-2010_1m-train'], layers=['naip', 'prior'], transforms=None, prior_as_input=False, cache=True, download=False, checksum=False)[source]#

Initialize a new Dataset instance.

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

  • splits (Sequence[str]) – a list of strings in the format “{state}-{train,val,test}” indicating the subset of data to use, for example “ny-train”

  • layers (Sequence[str]) – a list containing a subset of valid_layers indicating which layers to load

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

  • prior_as_input (bool) – bool describing whether the prior is used as an input (True) or as supervision (False)

  • cache (bool) – if True, cache file handle to speed up repeated sampling

  • 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]#

Retrieve input, target, and/or metadata indexed by spatiotemporal slice.

Parameters:

index (slice | tuple[slice] | tuple[slice, slice] | tuple[slice, slice, slice]) – [xmin:xmax:xres, ymin:ymax:yres, tmin:tmax:tres] coordinates to index.

Returns:

Sample of input, target, and/or metadata at that index.

Raises:

IndexError – If index is not found in the dataset.

Return type:

dict[str, Any]

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

Plot a sample from the dataset.

Note: only plots the “naip” and “lc” layers.

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:

ValueError – if the NAIP layer isn’t included in self.layers

Return type:

Figure

__annotate_func__()#

The type of the None singleton.