TlseHypDataSet.tlse_hyp_data_set.TlseHypDataSet

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)

__init__(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)
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)

Methods

__init__(root_path, pred_mode, patch_size[, ...])

param root_path

path to the folder where the data is stored

compute_patches()

compute_pixels()

load_splits([path, p_labeled, p_val, ...])

rasterize_gt_shapefile()

Rasterize the ground truth shapefile.

read_metadata()

save_data_set()

save_splits(solutions, p_labeled, p_val, ...)

split_already_computed(p_labeled, p_val, ...)

Attributes

areas

bands

return

A list of usable band indices

classes

colors

return

A dict of class colors for land cover maps

n_classes

n_samples

permeability

return

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

proj_data