subsample
- MPPData.subsample(frac=None, frac_per_obj=None, num=None, num_per_obj=None, add_neighborhood=False, neighborhood_size=3)[source]
Pixel-level subsampling of MPPData.
All other information is updated accordingly (to save RAM/HDD-memory). Additionally, can extend mpps’ representations by their neighbourhoods before subsampling.
Note that at least one of four parameters that indicate subsampling size (frac, num, frac_per_obj, num_per_obj) should be provided.
- Parameters
frac (
Optional[float]) – Subsample a random number of mpps (pixels) from the whole dataset by a specified fraction. Should be in range [0, 1].num (
Optional[int]) – Subsample a random number of mpps (pixels) from the whole dataset by a specified number of mpps to be chosen.frac_per_obj (
Optional[float]) – Allows to subsample a fraction of mpps on the object level - that is, for each object (cell) to subsample the same fraction of mpps independently.num_per_obj (
Optional[int]) – Same asfrac_per_obj, but a number of mpps to be left instead of fraction is provided.add_neighborhood (
bool) – If set to True, extends mpp representation with a square neighbourhood around it.neighborhood_size (
int) – Size of the neighbourhood.
- Return type
Subsampled MPPData. Operation cannot be done in place