OSCD#
- class torchgeo.datasets.OSCD(root='data', split='train', bands=('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B09', 'B10', 'B11', 'B12'), transforms=None, download=False, checksum=False)[source]#
Bases:
NonGeoDatasetOSCD dataset.
The Onera Satellite Change Detection dataset addresses the issue of detecting changes between satellite images from different dates. Imagery comes from Sentinel-2 which contains varying resolutions per band.
Dataset format:
images are 13-channel tifs
masks are single-channel pngs where no change = 0, change = 255
Dataset classes:
no change
change
If you use this dataset in your research, please cite the following paper:
Added in version 0.2.
- __init__(root='data', split='train', bands=('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B09', 'B10', 'B11', 'B12'), transforms=None, download=False, checksum=False)[source]#
Initialize a new OSCD dataset instance.
- Parameters:
root (str | PathLike[str]) – root directory where dataset can be found
split (str) – one of “train” or “test”
bands (Sequence[str]) – bands to return (defaults to all bands)
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:
AssertionError – if
splitargument is invalidDatasetNotFoundError – If dataset is not found and download is False.
- __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.
- __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
- Raises:
RGBBandsMissingError – If bands does not include all RGB bands.
- Return type:
- __annotate_func__()#
The type of the None singleton.
- class torchgeo.datasets.OSCD100(root='data', split='train', bands=('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B09', 'B10', 'B11', 'B12'), transforms=None, download=False, checksum=False)[source]#
Bases:
OSCDSubset of OSCD with 100 pre-cropped image pairs at 256x256 resolution.
Intended for tutorials and demonstrations, not benchmarking.
Maintains the same file structure and all 13 Sentinel-2 bands as OSCD, but with 100 pre-cropped 256x256 patches. Adds a validation split (train/val/test).
If you use this dataset in your research, please cite the following paper:
Added in version 0.9.
- __annotate_func__()#
The type of the None singleton.