xBD#
- class torchgeo.datasets.xBD(root='data', split='train', transforms=None, checksum=False)[source]#
Bases:
NonGeoDatasetxBD dataset.
The xBD dataset is a dataset for building disaster change detection. This dataset object uses the “Challenge training set (~7.8 GB)” and “Challenge test set (~2.6 GB)” data from the xView2 website as the train and test splits. Note, the xView2 website contains other data under the xView2 umbrella that are _not_ included here. E.g. the “Tier3 training data”, the “Challenge holdout set”, and the “full data”.
Dataset format:
images are three-channel pngs
masks are single-channel pngs where the pixel values represent the class
Dataset classes:
background
no damage
minor damage
major damage
destroyed
If you use this dataset in your research, please cite the following paper:
Added in version 0.2.
- __init__(root='data', split='train', transforms=None, checksum=False)[source]#
Initialize a new xBD dataset instance.
- Parameters:
root (str | PathLike[str]) – root directory where dataset can be found
split (str) – 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
checksum (bool) – if True, check the MD5 of the downloaded files (may be slow)
- Raises:
AssertionError – If split is invalid.
DatasetNotFoundError – If dataset is not found.
- __getitem__(index)[source]#
Return an index within the dataset.
Changed in version 0.8: Now returns a single T x C x H x W image, change detection mask.
- __len__()[source]#
Return the number of data points in the dataset.
- Returns:
length of the dataset
- Return type:
- plot(sample, show_titles=True, suptitle=None, alpha=0.5)[source]#
Plot a sample from the dataset.
- Parameters:
- Returns:
a matplotlib Figure with the rendered sample
- Return type:
- __annotate_func__()#
The type of the None singleton.