SkyScript#

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

Bases: NonGeoDataset

SkyScript dataset.

SkyScript is a large and semantically diverse image-text dataset for remote sensing images. It contains 5.2 million remote sensing image-text pairs in total, covering more than 29K distinct semantic tags.

If you use this dataset in your research, please cite it using the following format:

Added in version 0.6.

caption_files: ClassVar[dict[str, str]] = {'test': 'SkyScript_test_30K_filtered_by_CLIP_openai.csv', 'train': 'SkyScript_train_top30pct_filtered_by_CLIP_openai.csv', 'val': 'SkyScript_val_5K_filtered_by_CLIP_openai.csv'}#

Can be modified in subclasses to change train/val/test split

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

Initialize a new SkyScript instance.

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

  • split (str) – One of ‘train’, ‘val’, ‘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:
__len__()[source]#

Return the number of images 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:

A dict containing image and caption at 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

__annotate_func__()#

The type of the None singleton.