Functional Point cloud Transformations¤
Common preprocessing¤
center(pointclouds: Tensor) -> Tensor
¤
Center each element in a batch of point clouds (substract the mean over the second dim).
Parameters:
-
pointclouds
(Tensor
) –Batch of point clouds
(batch_size, num_points, *)
.
Returns:
-
Tensor
–Batch of centered point clouds.
Source code in src/polar/train/data/transforms/functionals.py
10 11 12 13 14 15 16 17 18 19 |
|
normalize(pointclouds: Tensor) -> Tensor
¤
Scale each element in a batch of point clouds so that it lies exactly within the unit sphere.
Parameters:
-
pointclouds
(Tensor
) –Batch of point clouds
(batch_size, num_points, *)
.
Returns:
-
Tensor
–Batch of normalized point clouds.
Source code in src/polar/train/data/transforms/functionals.py
22 23 24 25 26 27 28 29 30 31 32 33 |
|
pairwise_max_norm(pointclouds1: Tensor, pointclouds2: Tensor) -> tuple[Tensor, Tensor]
¤
Scale each pair of elements of the two batches by their maximal norm.
Warning
pointclouds1
and pointclouds2
MUST have the same length.
Parameters:
-
pointclouds1
(Tensor
) –Batch of point clouds
(batch_size, n, *)
. -
pointclouds2
(Tensor
) –Batch of point clouds
(batch_size, m, *)
.
Returns:
-
tuple[Tensor, Tensor]
–tuple[Tensor, Tensor]: The two batches of normalized point clouds.
Source code in src/polar/train/data/transforms/functionals.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
sample(pointclouds: Tensor, indices: Tensor) -> Tensor
¤
Sample the elements of the batch using the provided index tensor.
Parameters:
-
pointclouds
(Tensor
) –Batch of point clouds
(batch_size, num_points, *)
. -
indices
(Tensor
) –Tensor of indices to keep
(batch_size, num_sampled_points)
.
Returns:
-
Tensor
–Batch of sampled point clouds
(batch_size, num_sampled_points, *)
.
Source code in src/polar/train/data/transforms/functionals.py
40 41 42 43 44 45 46 47 48 49 50 |
|
SIM(3)¤
translate(pointclouds: Tensor, t: Tensor) -> Tensor
¤
Apply a unique translation to each element of the batch of point clouds.
Parameters:
-
pointclouds
(Tensor
) –Batch of point clouds
(batch_size, num_points, *)
. -
t
(Tensor
) –Batch of translation vectors
(batch_size, *)
.
Returns:
-
Tensor
–Batch of translated point clouds
(batch_size, num_points, *)
.
Source code in src/polar/train/data/transforms/functionals.py
77 78 79 80 81 82 83 84 85 86 87 |
|
rotate(pointclouds: Tensor, R: Tensor) -> Tensor
¤
Apply a unique rotation to each element of the batch of point clouds.
Parameters:
-
pointclouds
(Tensor
) –Batch of point clouds
(batch_size, num_points, 3)
. -
R
(Tensor
) –Batch of rotation matrices
(batch_size, 3, 3)
.
Returns:
-
Tensor
–Batch of rotated point clouds
(batch_size, num_points, 3)
.
Source code in src/polar/train/data/transforms/functionals.py
90 91 92 93 94 95 96 97 98 99 100 |
|
apply_rigid_motion(pointclouds: Tensor, R_or_T: Tensor, t: Tensor | None = None) -> Tensor
¤
Apply a unique rigid motion, i.e. the composition of a rotation and a translation to each point cloud in the batch.
Parameters:
-
pointclouds
(Tensor
) –Batch of point clouds
(batch_size, num_points, *)
. -
R_or_T
(Tensor
) –If
t
is None, this must be a rigid motion matrix(batch_size, 4, 4)
. -
t
(Tensor | None
, default:None
) –Batch of translation vectors
(batch_size, 3)
. Defaults toNone
.
Raises:
-
ValueError
–If
t
isNone
andR_or_T
is not of shape(batch_size, 4, 4)
.
Returns:
-
Tensor
(Tensor
) –Batch of rigidly moved point clouds
(batch_size, num_points, 3)
.
Source code in src/polar/train/data/transforms/functionals.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
scale(pointclouds: Tensor, values: Tensor) -> Tensor
¤
Apply a unique scaling factor to each point cloud in the provided batch.
Parameters:
-
pointclouds
(Tensor
) –Batch of point clouds
(batch_size, num_points, *)
. -
values
(Tensor
) –Batch of scalar scaling values
(batch_size,)
.
Returns:
-
Tensor
–Batch of scaled point clouds
(batch_size, num_points, *)
.
Source code in src/polar/train/data/transforms/functionals.py
126 127 128 129 130 131 132 133 134 135 136 |
|
Augment¤
jit(pointclouds: Tensor, sigmas: Tensor) -> Tensor
¤
Add white gaussian noise with variance specified per batch element.
Parameters:
-
pointclouds
(Tensor
) –Batch of point clouds
(batch_size, num_points, *)
. -
sigmas
(Tensor
) –Noise variance per batch element.
Returns:
-
Tensor
(Tensor
) –Noisy batch of point clouds X = X + eps, eps ~ N(0, sigma)
Source code in src/polar/train/data/transforms/functionals.py
143 144 145 146 147 148 149 150 151 152 153 154 |
|
plane_cut(pointclouds: Tensor, planes: Tensor, keep_ratio: float, return_mask: bool) -> Tensor | tuple[Tensor, Tensor]
¤
Being given a direction in \(\mathcal{S}_3\), retain points which lie within the half-space oriented in
this direction, such that keep_ratio * num_points
are retained.
Parameters:
-
pointclouds
(Tensor
) –Batch of point clouds of shape
(batch_size, num_points, 3)
. -
planes
(Tensor
) –Batch of direction in S3, of shape
(batch_size, 3)
. -
keep_ratio
(float
) –Ratio of points to retain. Outputs will be shaped
(batch_size, n, 3)
, wheren = keep_ratio * num_points
. -
return_mask
(bool
) –Whether to return the cropping mask alongside the cutted batch.
Returns:
-
Tensor
(Tensor | tuple[Tensor, Tensor]
) –Batch of cutted pointclouds, of shape
(batch_size, keep_ratio * num_points, 3)
.
Source code in src/polar/train/data/transforms/functionals.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|