faninsar.samplers.ColSampler#
- class faninsar.samplers.ColSampler(dataset: GeoDataset, roi: BoundingBox | None = None, col_num: int | None = None, width: int | None = None, verbose: bool = True)[source]#
Bases:
PatchSamplerA sampler samples data from a dataset in a col-wise manner.
This class is used to sample data from a dataset. The dataset is represented by a bounding box, and the sampler is used to sample data in the bounding box. The result of sampling is an iterator that yields data from the dataset.
- __init__(dataset: GeoDataset, roi: BoundingBox | None = None, col_num: int | None = None, width: int | None = None, verbose: bool = True) None[source]#
Initialize a ColSampler.
- Parameters:
dataset (GeoDataset) – The dataset needs to be sampled.
roi (BoundingBox or Sequence, optional) – The the region of interest bounding box. If not provided, the bounding box of the dataset will be used.
col_num (int, optional) – The number of patches to be sampled for row-wise sampling. If width is provided, this parameter will be ignored.
width (int, optional) – The width (in pixel) of the patch to be sampled for col-wise sampling. if not provided, the col_num will be used.
verbose (bool, optional) – Whether to print verbose information. The verbose of the dataset will be set to this value. Default is True.
Methods
__init__(dataset[, roi, col_num, width, verbose])Initialize a ColSampler.
Attributes
The bounding boxes/patches of the sampler used to sample dataset.
The shape of the patch sampler.