DOTA#

class torchgeo.datasets.DOTA(root='data', split='train', version='2.0', bbox_orientation='oriented', transforms=None, download=False, checksum=False)[source]#

Bases: NonGeoDataset

DOTA dataset.

DOTA is a large-scale object detection dataset for aerial imagery containing RGB and gray-scale imagery from Google Earth, GF-2 and JL-1 satellites as well as additional aerial imagery from CycloMedia. There are three versions of the dataset: v1.0, v1.5, and v2.0, where, v1.0 and v1.5 have the same images but different annotations, and v2.0 extends both the images and annotations with more samples

Dataset features:

  • 1869 samples in v1.0 and v1.5 and 2423 samples in v2.0

  • multi-class object detection (15 classes in v1.0 and v1.5 and 18 classes in v2.0)

  • horizontal and oriented bounding boxes

Dataset format:

  • images are three channel PNGs with various pixel sizes

  • annotations are text files with one line per bounding box

Classes:

  1. plane

  2. ship

  3. storage-tank

  4. baseball-diamond

  5. tennis-court

  6. basketball-court

  7. ground-track-field

  8. harbor

  9. bridge

  10. large-vehicle

  11. small-vehicle

  12. helicopter

  13. roundabout

  14. soccer-ball-field

  15. swimming-pool

  16. container-crane (v1.5+)

  17. airport (v2.0+)

  18. helipad (v2.0+)

If you use this work in your research, please cite the following papers:

Added in version 0.7.

__init__(root='data', split='train', version='2.0', bbox_orientation='oriented', transforms=None, download=False, checksum=False)[source]#

Initialize a new DOTA dataset instance.

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

  • split (Literal['train', 'val']) – split of the dataset to use, one of [‘train’, ‘val’]

  • version (Literal['1.0', '1.5', '2.0']) – version of the dataset to use, one of [‘1.0’, ‘1.5’, ‘2.0’]

  • bbox_orientation (Literal['horizontal', 'oriented']) – bounding box orientation, one of [‘horizontal’, ‘oriented’], where horizontal returnx xyxy format and oriented returns x1y1x2y2x3y3x4y4 format

  • 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:
__len__()[source]#

Return the number of samples in the dataset.

Returns:

length of the dataset

Return type:

int

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

__annotate_func__()#

The type of the None singleton.

plot(sample, show_titles=True, suptitle=None, box_alpha=0.7)[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

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

  • box_alpha (float) – alpha value for boxes

Returns:

a matplotlib Figure with the rendered sample

Return type:

Figure