iNaturalist#

class torchgeo.datasets.INaturalist(root='data')[source]#

Bases: GeoDataset

Dataset for iNaturalist.

iNaturalist is a joint initiative of the California Academy of Sciences and the National Geographic Society. It allows citizen scientists to upload observations of organisms that can be downloaded by scientists and researchers.

If you use an iNaturalist dataset in your research, please cite it according to:

Added in version 0.3.

__init__(root='data')[source]#

Initialize a new Dataset instance.

Parameters:

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

Raises:

DatasetNotFoundError – If dataset is not found.

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

Parameters:
  • sample (dict[str, Any]) – a sample return by __getitem__()

  • show_titles (bool) – flag indicating whether to show titles above each panel

  • suptitle (str | None) – optional suptitle to use for Figure

Returns:

a matplotlib Figure with the rendered sample

Return type:

Figure

Added in version 0.8.