Getting started
Install TlseHypDataSet (compatible with Python>=3.8,<3.1) with pip:
$ pip install TlseHypDataSet
Download the hyperspectral images at www.toulouse-hyperspectral-data-set.com in an images
folder:
/path/to/dataset/
├── images
├── TLS_1b_2021-06-15_10-41-20_reflectance_rect.bsq
├── TLS_1b_2021-06-15_10-41-20_reflectance_rect.hdr
├── ...
The TlseHypDataSet
class has a standard_splits
attribute that contains 8 standard splits of the ground truth in a 'train'
set, a 'labeled_pool'
, an 'unlabeled_pool'
, a 'validation'
set and a 'test'
set, as explained here. The following example shows how to load the training set of the first standard train / test split in a Pytorch data loader with the DisjointDataSplit
class (see the Dataset and the Spatially disjoint ground truth splits sections for more details):
import torch
from TlseHypDataSet.tlse_hyp_data_set import TlseHypDataSet
from TlseHypDataSet.utils.dataset import DisjointDataSplit
dataset = TlseHypDataSet('/path/to/dataset/', pred_mode='pixel', patch_size=1)
# Load the first standard ground truth split
ground_truth_split = DisjointDataSplit(dataset, split=dataset.standard_splits[0])
train_loader = torch.utils.data.DataLoader(
ground_truth_split.sets_['train'],
shuffle=True,
batch_size=1024
)
for epoch in range(100):
for samples, labels in train_loader:
...
NB: at first use, the images and the ground truth will be processed and additional data will be saved in a rasters
folder.