ReforesTree#

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

Bases: NonGeoDataset

ReforesTree dataset.

The ReforesTree dataset contains drone imagery that can be used for tree crown detection, tree species classification and Aboveground Biomass (AGB) estimation.

Dataset features:

  • 100 high resolution RGB drone images at 2 cm/pixel of size 4,000 x 4,000 px

  • more than 4,600 tree crown box annotations

  • tree crown matched with field measurements of diameter at breast height (DBH), and computed AGB and carbon values

Dataset format:

  • images are three-channel pngs

  • annotations are csv file

Dataset Classes:

  1. other

  2. banana

  3. cacao

  4. citrus

  5. fruit

  6. timber

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

Added in version 0.3.

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

Initialize a new ReforesTree 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