vis4d.data.transforms.point_sampling

Contains different Sampling Trasnforms for pointclouds.

Classes

GenFullCovBlockSamplingIndices(*[, in_keys, ...])

Subsamples the pointcloud using blocks of a given size.

GenerateBlockSamplingIndices(*[, in_keys, ...])

Samples num_pts from the first dim of the provided data tensor.

GenerateSamplingIndices(*[, in_keys, ...])

Samples num_pts from the first dim of the provided data tensor.

SampleColors(*[, in_keys, out_keys, ...])

Subsamples colors randomly.

SampleInstances(*[, in_keys, out_keys, ...])

Subsamples instances randomly.

SamplePoints(*[, in_keys, out_keys, ...])

Subsamples points randomly.

SampleSemantics(*[, in_keys, out_keys, ...])

Subsamples semantics randomly.

class GenFullCovBlockSamplingIndices(*, in_keys=['points3d'], out_keys=['transforms.sampling_idxs'], sensors=None, same_on_batch=True, **kwargs)[source]

Subsamples the pointcloud using blocks of a given size.

__call__(coordinates_list)[source]

Subsamples the pointcloud using blocks of a given size.

Return type:

list[Union[ndarray[Any, dtype[int32]], ndarray[Any, dtype[int64]]]]

class GenerateBlockSamplingIndices(*, in_keys=['points3d'], out_keys=['transforms.sampling_idxs'], sensors=None, same_on_batch=True, **kwargs)[source]

Samples num_pts from the first dim of the provided data tensor.

Makes sure that the sampled points are within a block of size block_size centered around center_xyz. If num_pts > data.shape[0], the indices will be upsampled with replacement. If num_pts < data.shape[0], the indices will be sampled without replacement.

__call__(data_list)[source]

Samples num_pts from the first dim of the provided data tensor.

Return type:

list[Union[ndarray[Any, dtype[int32]], ndarray[Any, dtype[int64]]]]

class GenerateSamplingIndices(*, in_keys=['points3d'], out_keys=['transforms.sampling_idxs'], sensors=None, same_on_batch=True, **kwargs)[source]

Samples num_pts from the first dim of the provided data tensor.

If num_pts > data.shape[0], the indices will be upsampled with replacement. If num_pts < data.shape[0], the indices will be sampled without replacement.

__call__(data_list)[source]

Samples num_pts from the first dim of the provided data tensor.

If num_pts > data.shape[0], the indices will be upsampled with replacement. If num_pts < data.shape[0], the indices will be sampled without replacement.

Parameters:

data_list (list[NDArrayNumber]) – Data from which to sample indices.

Returns:

List of indices.

Return type:

list[NDArrayInt]

Raises:

ValueError – If data is empty.

class SampleColors(*, in_keys=['colors3d', 'transforms.sampling_idxs'], out_keys=['colors3d'], sensors=None, same_on_batch=True, **kwargs)[source]

Subsamples colors randomly.

Samples ‘num_pts’ randomly from the provided data tensors using the provided sampling indices.

This transform is used to sample colors from a pointcloud. The indices are generated by the GenerateSamplingIndices transform.

class SampleInstances(*, in_keys=['instances3d', 'transforms.sampling_idxs'], out_keys=['instances3d'], sensors=None, same_on_batch=True, **kwargs)[source]

Subsamples instances randomly.

Samples ‘num_pts’ randomly from the provided data tensors using the provided sampling indices.

This transform is used to sample instances from a pointcloud. The indices are generated by the GenerateSamplingIndices transform.

class SamplePoints(*, in_keys=['points3d', 'transforms.sampling_idxs'], out_keys=['points3d'], sensors=None, same_on_batch=True, **kwargs)[source]

Subsamples points randomly.

Samples ‘num_pts’ randomly from the provided data tensors using the provided sampling indices.

This transform is used to sample points from a pointcloud. The indices are generated by the GenerateSamplingIndices transform.

__call__(data_list, selected_idxs_list)[source]

Returns data[selected_idxs].

If the provided indices have two dimension (i.e n_masks, 64), then this operation indices the data n_masks times and returns an array

Return type:

list[Union[ndarray[Any, dtype[bool_]], ndarray[Any, dtype[float32]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[int32]], ndarray[Any, dtype[int64]], ndarray[Any, dtype[uint8]], ndarray[Any, dtype[uint16]], ndarray[Any, dtype[uint32]]]]

class SampleSemantics(*, in_keys=['semantics3d', 'transforms.sampling_idxs'], out_keys=['semantics3d'], sensors=None, same_on_batch=True, **kwargs)[source]

Subsamples semantics randomly.

Samples ‘num_pts’ randomly from the provided data tensors using the provided sampling indices.

This transform is used to sample semantics from a pointcloud. The indices are generated by the GenerateSamplingIndices transform.