Dataset

class TlseHypDataSet.tlse_hyp_data_set.TlseHypDataSet(root_path: str, pred_mode: str, patch_size: int, annotations: str = 'land_cover', images: Optional[List] = None, in_h5py: bool = False, data_on_gpu: bool = False)

A torch.utils.data.Dataset object to process the Toulouse Hyperspectral Data Set

Parameters
  • root_path – path to the folder where the data is stored

  • pred_mode – ‘pixel’ for pixel-wise classification or ‘patch’ for patch segmentation

  • patch_size – size of the patch, i.e. gives (batch_size x patch_size x patch_size x n_bands) dimensional samples

  • annotations – ‘land_cover’, ‘land_use’ or ‘both’

  • images – select a subset of image tiles by specifying tile index (in the following order [3d, 1c, 3a, 5c, 1d, 9c, 1b, 1e, 3e])

  • in_h5py – if True, save the data samples and labels in h5py files to speed up data reading

  • data_on_gpu – if True, store the whole data on the device (e.g. on the gpu)

>>> from TlseHypDataSet.tlse_hyp_data_set import TlseHypDataSet
>>> dataset = TlseHypDataSet('/path/to/dataset', pred_mode='pixel', patch_size=5)
>>> sample, label = next(iter(dataset))
>>> sample.shape
torch.Size([5, 5, 310]) # 310 is the number of spectral channels
>>> label.shape
torch.Size([])
>>> dataset = TlseHypDataSet('/path/to/dataset', pred_mode='patch', patch_size=5)
>>> sample, labels = next(iter(dataset))
>>> sample.shape
torch.Size([5, 5, 310]) # 310 is the number of spectral channels
>>> labels.shape
torch.Size([5, 5])
property E_dif
Returns

The diffuse irradiance at ground level

property E_dir
Returns

The direct irradiance at ground level

property bands
Returns

A list of usable band indices

property bbl
Returns

A list of bad bands (i.e. unusable spectral channels) encoded by zeros

property bottom_to_top
Returns

A dict whose keys are bottom land cover classes and values are top land cover classes in the hierarchical nomenclature

property colors
Returns

A dict of class colors for land cover maps

property land_cover_nomenclature
Returns

A dict with the children land cover classes (bottom of the hierarchy)

property land_cover_nomenclature_top
Returns

A dict with the parent land cover classes (top of the hierarchy)

property land_use_nomenclature
Returns

A dict with the land use classes

property n_bands
Returns

The number of usable spectral channels

property permeability
Returns

A dict with the permeability of the land cover (0 = impermeable, 1 = permeable)

rasterize_gt_shapefile()

Rasterize the ground truth shapefile.

property standard_splits
Returns

A list of 8 spatially disjoint splits of the ground truth

property theta
Returns

The solar zenith angle

property wv
Returns

A list of the spectral channels wavelengths