SpaceNet#

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

Bases: NonGeoDataset, ABC

Abstract base class for the SpaceNet datasets.

The SpaceNet datasets are a set of datasets that all together contain >11M building footprints and ~20,000 km of road labels mapped over high-resolution satellite imagery obtained from a variety of sensors such as Worldview-2, Worldview-3 and Dove.

Note

The SpaceNet datasets require the following additional library to be installed:

  • AWS CLI: to download the dataset from AWS.

abstract property dataset_id: str#

Dataset ID.

abstract property tarballs: dict[str, dict[int, list[str]]]#

Mapping of tarballs[split][aoi] = [tarballs].

abstract property md5s: dict[str, dict[int, list[str]]]#

Mapping of md5s[split][aoi] = [md5s].

abstract property valid_aois: dict[str, list[int]]#

Mapping of valid_aois[split] = [aois].

abstract property valid_images: dict[str, list[str]]#

Mapping of valid_images[split] = [images].

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

List of valid masks.

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

Initialize a new SpaceNet Dataset instance.

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

  • split (str) – ‘train’ or ‘test’ split

  • aois (list[int]) – areas of interest

  • image (str | None) – image selection

  • mask (str | None) – mask selection

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

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.

__annotate_func__()#

The type of the None singleton.

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

Bases: SpaceNet

SpaceNet 1: Building Detection v1 Dataset.

SpaceNet 1 is a dataset of building footprints over the city of Rio de Janeiro.

Dataset features:

  • No. of images: 6940 (8 Band) + 6940 (RGB)

  • No. of polygons: 382,534 building labels

  • Area Coverage: 2544 sq km

  • GSD: 1 m (8 band), 50 cm (rgb)

  • Chip size: 102 x 110 (8 band), 406 x 439 (rgb)

Dataset format:

  • Imagery - Worldview-2 GeoTIFFs

    • 8Band.tif (Multispectral)

    • RGB.tif (Pansharpened RGB)

  • Labels - GeoJSON

    • labels.geojson

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

__annotate_func__()#

The type of the None singleton.

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

Bases: SpaceNet

SpaceNet 2: Building Detection v2 Dataset.

SpaceNet 2 is a dataset of building footprints over the cities of Las Vegas, Paris, Shanghai and Khartoum.

Collection features:

AOI

Area (km2)

# Images

# Buildings

Las Vegas

216

3850

151,367

Paris

1030

1148

23,816

Shanghai

1000

4582

92,015

Khartoum

765

1012

35,503

Imagery features:

PAN

MS

PS-MS

PS-RGB

GSD (m)

0.31

1.24

0.30

0.30

Chip size (px)

650 x 650

163 x 163

650 x 650

650 x 650

Dataset format:

  • Imagery - Worldview-3 GeoTIFFs

    • PAN.tif (Panchromatic)

    • MS.tif (Multispectral)

    • PS-MS (Pansharpened Multispectral)

    • PS-RGB (Pansharpened RGB)

  • Labels - GeoJSON

    • label.geojson

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

__annotate_func__()#

The type of the None singleton.

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

Bases: SpaceNet

SpaceNet 3: Road Network Detection.

SpaceNet 3 is a dataset of road networks over the cities of Las Vegas, Paris, Shanghai, and Khartoum.

Collection features:

AOI

Area (km2)

# Images

# Road Network Labels (km)

Vegas

216

854

3685

Paris

1030

257

425

Shanghai

1000

1028

3537

Khartoum

765

283

1030

Imagery features:

PAN

MS

PS-MS

PS-RGB

GSD (m)

0.31

1.24

0.30

0.30

Chip size (px)

1300 x 1300

325 x 325

1300 x 1300

1300 x 1300

Dataset format:

  • Imagery - Worldview-3 GeoTIFFs

    • PAN.tif (Panchromatic)

    • MS.tif (Multispectral)

    • PS-MS (Pansharpened Multispectral)

    • PS-RGB (Pansharpened RGB)

  • Labels - GeoJSON

    • labels.geojson

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

Added in version 0.3.

__annotate_func__()#

The type of the None singleton.

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

Bases: SpaceNet

SpaceNet 4: Off-Nadir Buildings Dataset.

SpaceNet 4 is a dataset of 27 WV-2 imagery captured at varying off-nadir angles and associated building footprints over the city of Atlanta. The off-nadir angle ranges from 7 degrees to 54 degrees.

Dataset features:

  • No. of chipped images: 28,728 (PAN/MS/PS-RGBNIR)

  • No. of label files: 1064

  • No. of building footprints: >120,000

  • Area Coverage: 665 sq km

  • Chip size: 225 x 225 (MS), 900 x 900 (PAN/PS-RGBNIR)

Dataset format:

  • Imagery - Worldview-2 GeoTIFFs

    • PAN.tif (Panchromatic)

    • MS.tif (Multispectral)

    • PS-RGBNIR (Pansharpened RGBNIR)

  • Labels - GeoJSON

    • labels.geojson

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

__annotate_func__()#

The type of the None singleton.

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

Bases: SpaceNet3

SpaceNet 5: Automated Road Network Extraction and Route Travel Time Estimation.

SpaceNet 5 is a dataset of road networks over the cities of Moscow, Mumbai and San Juan (unavailable).

Collection features:

AOI

Area (km2)

# Images

# Road Network Labels (km)

Moscow

1353

1353

3066

Mumbai

1021

1016

1951

Imagery features:

PAN

MS

PS-MS

PS-RGB

GSD (m)

0.31

1.24

0.30

0.30

Chip size (px)

1300 x 1300

325 x 325

1300 x 1300

1300 x 1300

Dataset format:

  • Imagery - Worldview-3 GeoTIFFs

    • PAN.tif (Panchromatic)

    • MS.tif (Multispectral)

    • PS-MS (Pansharpened Multispectral)

    • PS-RGB (Pansharpened RGB)

  • Labels - GeoJSON

    • labels.geojson

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

Added in version 0.2.

__annotate_func__()#

The type of the None singleton.

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

Bases: SpaceNet

SpaceNet 6: Multi-Sensor All-Weather Mapping.

SpaceNet 6 is a dataset of optical and SAR imagery over the city of Rotterdam.

Collection features:

AOI

Area (km2)

# Images

# Building Footprint Labels

Rotterdam

120

3401

48000

Imagery features:

PAN

RGBNIR

PS-RGB

PS-RGBNIR

SAR-Intensity

GSD (m)

0.5

2.0

0.5

0.5

0.5

Chip size (px)

900 x 900

450 x 450

900 x 900

900 x 900

900 x 900

Dataset format:

  • Imagery - GeoTIFFs from Worldview-2 (optical) and Capella Space (SAR)

    • PAN.tif (Panchromatic)

    • RGBNIR.tif (Multispectral)

    • PS-RGB (Pansharpened RGB)

    • PS-RGBNIR (Pansharpened RGBNIR)

    • SAR-Intensity (SAR Intensity)

  • Labels - GeoJSON

    • labels.geojson

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

Added in version 0.4.

__annotate_func__()#

The type of the None singleton.

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

Bases: SpaceNet

SpaceNet 7: Multi-Temporal Urban Development Challenge.

SpaceNet 7 is a dataset which consist of medium resolution (4.0m) satellite imagery mosaics acquired from Planet Labs’ Dove constellation between 2017 and 2020. It includes ≈ 24 images (one per month) covering > 100 unique geographies, and comprises > 40,000 km2 of imagery and exhaustive polygon labels of building footprints therein, totaling over 11M individual annotations.

Dataset features:

  • No. of train samples: 1423

  • No. of test samples: 466

  • No. of building footprints: 11,080,000

  • Area Coverage: 41,000 sq km

  • Chip size: 1024 x 1024

  • GSD: ~4m

Dataset format:

  • Imagery - Planet Dove GeoTIFF

    • mosaic.tif

  • Labels - GeoJSON

    • labels.geojson

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

Added in version 0.2.

__annotate_func__()#

The type of the None singleton.

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

Bases: SpaceNet

SpaceNet8: Flood Detection Challenge Using Multiclass Segmentation.

SpaceNet 8 is a dataset focusing on infrastructure and flood mapping related to hurricanes and heavy rains that cause route obstructions and significant damage.

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

Added in version 0.6.

__annotate_func__()#

The type of the None singleton.