pysegcnn.core.dataset.Cloud95Dataset¶
-
class
pysegcnn.core.dataset.
Cloud95Dataset
(root_dir, use_bands=[], tile_size=None, pad=False, gt_pattern='(.*)gt\\.tif', sort=False, seed=0, transforms=[])[source]¶ Class for the Cloud-95 dataset by Mohajerani & Saeedi (2020).
- Parameters
root_dir (str) – The root directory, path to the dataset.
use_bands (list [str], optional) – A list of the spectral bands to use. The default is [].
tile_size (int or None, optional) – The size of the tiles. If not None, each scene is divided into square tiles of shape (tile_size, tile_size). The default is None.
pad (bool, optional) – Whether to center pad the input image. Set
pad
= True, if the images are not evenly divisible by thetile_size
. The image data is padded with a constant padding value of zero. For each image, the corresponding ground truth image is padded with a “no data” label. The default is False.gt_pattern (str, optional) – A regural expression to match the ground truth naming convention. All directories and subdirectories in
root_dir
are searched for files matchinggt_pattern
. The default is ‘(.*)gt\.tif’.sort (bool, optional) – Whether to chronologically sort the samples. Useful for time series data. The default is False.
seed (int, optional) – The random seed. Used to split the dataset into training, validation and test set. Useful for reproducibility. The default is 0.
transforms (list [pysegcnn.core.split.Augment], optional) – List of pysegcnn.core.split.Augment instances. Each item in
transforms
generates a distinct transformed version of the dataset. The total dataset is composed of the original untransformed dataset together with each transformed version of it. Iftransforms
= [], only the original dataset is used. The default is [].
- Returns
- Return type
None.
Methods
build_samples
(scene)Stack the bands of a sample in a single array.
compose_scenes
()Build the list of samples of the dataset.
get_labels
()Class labels of the Cloud-95 dataset.
get_sensor
()Landsat 8 bands of the Cloud-95 dataset.
get_size
()Image size of the Cloud-95 dataset.
parse_scene_id
(scene_id)Parse Sparcs scene identifiers (Landsat 8).
preprocess
(data, gt)Preprocess Cloud-95 dataset images.
read_scene
(idx)Read the data of the sample with index
idx
.to_tensor
(x, dtype)Convert
x
to torch.Tensor.-
__init__
(root_dir, use_bands=[], tile_size=None, pad=False, gt_pattern='(.*)gt\\.tif', sort=False, seed=0, transforms=[])[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(root_dir[, use_bands, tile_size, …])Initialize self.
build_samples
(scene)Stack the bands of a sample in a single array.
compose_scenes
()Build the list of samples of the dataset.
get_labels
()Class labels of the Cloud-95 dataset.
get_sensor
()Landsat 8 bands of the Cloud-95 dataset.
get_size
()Image size of the Cloud-95 dataset.
parse_scene_id
(scene_id)Parse Sparcs scene identifiers (Landsat 8).
preprocess
(data, gt)Preprocess Cloud-95 dataset images.
read_scene
(idx)Read the data of the sample with index
idx
.to_tensor
(x, dtype)Convert
x
to torch.Tensor.