VHR-10#

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

Bases: NonGeoDataset

NWPU VHR-10 dataset.

Northwestern Polytechnical University (NWPU) very-high-resolution ten-class (VHR-10) remote sensing image dataset.

Consists of 800 VHR optical remote sensing images, where 715 color images were acquired from Google Earth with the spatial resolution ranging from 0.5 to 2 m, and 85 pansharpened color infrared (CIR) images were acquired from Vaihingen data with a spatial resolution of 0.08 m.

The data set is divided into two sets:

  • Positive image set (650 images) which contains at least one target in an image

  • Negative image set (150 images) does not contain any targets

The positive image set consists of objects from ten classes:

  1. Airplanes (757)

  2. Ships (302)

  3. Storage tanks (655)

  4. Baseball diamonds (390)

  5. Tennis courts (524)

  6. Basketball courts (159)

  7. Ground track fields (163)

  8. Harbors (224)

  9. Bridges (124)

  10. Vehicles (477)

Includes object detection bounding boxes from original paper and instance segmentation masks from follow-up publications. If you use this dataset in your research, please cite the following papers:

Note

This dataset requires the following additional library to be installed:

  • pycocotools to load the annotations.json file for the “positive” image set

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

Initialize a new VHR-10 dataset instance.

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

  • split (str) – one of “positive” or “negative”

  • 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

plot(sample, show_titles=True, suptitle=None, show_feats='both', box_alpha=0.7, mask_alpha=0.7)[source]#

Plot a sample from the dataset.

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

  • suptitle (str | None) – optional string to use as a suptitle

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

  • show_feats (str | None) – optional string to pick features to be shown: boxes, masks, both

  • box_alpha (float) – alpha value of box

  • mask_alpha (float) – alpha value of mask

Returns:

a matplotlib Figure with the rendered sample

Raises:
Return type:

Figure

Added in version 0.4.

__annotate_func__()#

The type of the None singleton.