COWC#

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

Bases: NonGeoDataset, ABC

Abstract base class for the COWC dataset.

The Cars Overhead With Context (COWC) data set is a large set of annotated cars from overhead. It is useful for training a device such as a deep neural network to learn to detect and/or count cars.

The dataset has the following attributes:

  1. Data from overhead at 15 cm per pixel resolution at ground (all data is EO).

  2. Data from six distinct locations: Toronto, Canada; Selwyn, New Zealand; Potsdam and Vaihingen, Germany; Columbus, Ohio and Utah, United States.

  3. 32,716 unique annotated cars. 58,247 unique negative examples.

  4. Intentional selection of hard negative examples.

  5. Established baseline for detection and counting tasks.

  6. Extra testing scenes for use after validation.

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

abstract property base_url: str#

Base URL to download dataset from.

abstract property filenames: tuple[str, ...]#

List of files to download.

abstract property md5s: tuple[str, ...]#

List of MD5 checksums of files to download.

abstract property filename: str#

Filename containing train/test split and target labels.

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

Initialize a new COWC dataset instance.

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

  • split (Literal['train', 'test']) – one of “train” or “test”

  • 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)[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

Added in version 0.2.

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

Bases: COWC

COWC Dataset for car counting.

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

Bases: COWC

COWC Dataset for car detection.