Solar Plants Brazil#

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

Bases: NonGeoDataset

Solar Plants Brazil dataset (semantic segmentation for photovoltaic detection).

The Solar Plants Brazil dataset provides satellite imagery and pixel-level annotations for detecting photovoltaic solar power stations.

Dataset features:

  • 272 RGB+NIR GeoTIFF images (256x256 pixels)

  • Binary masks indicating presence of solar panels (1 = panel, 0 = background)

  • Organized into train, val, and test splits

  • Float32 GeoTIFF files for both input and mask images

  • Spatial metadata included (CRS, bounding box), but not used directly for training

Folder structure:

root/train/input/img(123).tif
root/train/labels/target(123).tif

Access:

Added in version 0.8.

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

Initialize a SolarPlantsBrazil dataset split.

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

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

  • transforms (Callable[[dict[str, Any]], dict[str, Any]] | None) – a function/transform that takes an input sample 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:

DatasetNotFoundError – If dataset is not found and download is False.

__getitem__(index)[source]#

Return the image and mask at the given index.

Parameters:

index (int) – index of the image and mask to return

Returns:

image and mask at given index

Return type:

dict[str, Any]

__len__()[source]#

Return the number of samples in the dataset.

Returns:

The number of image-mask pairs in the dataset.

Return type:

int

plot(sample, suptitle=None)[source]#

Plot a sample from the SolarPlantsBrazil dataset.

Parameters:
  • sample (dict[str, Tensor]) – A dictionary with ‘image’ and ‘mask’ tensors. Optionally, a ‘prediction’ tensor can be provided to visualize model outputs.

  • suptitle (str | None) – Optional string to use as a suptitle.

Returns:

A matplotlib Figure with the rendered image and mask.

Return type:

Figure