Forest Damage#

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

Bases: NonGeoDataset

Forest Damage dataset.

The ForestDamage dataset contains drone imagery that can be used for tree identification, as well as tree damage classification for larch trees.

Dataset features:

  • 1543 images

  • 101,878 tree annotations

  • subset of 840 images contain 44,522 annotations about tree health (Healthy (H), Light Damage (LD), High Damage (HD)), all other images have “other” as damage level

Dataset format:

Dataset Classes:

  1. other

  2. healthy

  3. light damage

  4. high damage

If the download fails or stalls, it is recommended to try azcopy as suggested here. It is expected that the downloaded data file with name Data_Set_Larch_Casebearer can be found in root.

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

  • Swedish Forest Agency (2021): Forest Damages - Larch Casebearer 1.0. National Forest Data Lab. Dataset.

Added in version 0.3.

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

Initialize a new ForestDamage dataset instance.

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

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

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:

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

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

Return type:

Figure