augmentation
Random geometric and color augmentations.
Classes:
-
RandomRotateβRotate one or more keys (and optionally oriented boxes) by a uniformly random angle around an axis.
-
RandomScaleβScale one or more keys (and optionally oriented boxes) by a uniformly random factor.
-
RandomFlipβFlip listed axes (and optionally oriented boxes) with probability
peach. -
RandomJitterβAdd Gaussian noise to listed keys, optionally clipped.
-
RandomTranslateβTranslate listed keys (and optionally oriented boxes) by a uniformly random vector.
-
RandomColorJitterβJitter colors by brightness, contrast, and saturation strengths.
-
RandomColorDropβReplace colors with a constant gray value with probability
p. -
RandomColorGrayScaleβConvert listed color keys to grayscale (BT.601 luminance) with probability
p. -
RandomColorAutoContrastβStretch per-cloud color range to the full extent, then blend back, with probability
p. -
RandomRotateChoiceβRotate one or more keys by an angle chosen uniformly from a discrete list.
-
RandomColorShiftβAdditive per-channel color shift sampled uniformly per channel.
-
RandomElasticDistortionβApply a smooth random displacement field (elastic distortion).
RandomRotate [source] ΒΆ
RandomRotate(
keys: KeyCollection,
angle_range: Tuple[float, float] = (-180.0, 180.0),
axis: int = 2,
p: float = 1.0,
box_key: Optional[str] = None,
center: Union[str, Sequence[float]] = "origin",
vector_keys: Optional[KeyCollection] = None,
dst_keys: Optional[KeyCollection] = None,
dst_box_key: Optional[str] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Rotate one or more keys (and optionally oriented boxes) by a uniformly random angle around an axis.
Sampling is done once per call: every listed key and the optional box get the same rotation. Each key is a \((\ldots, 3)\) field or a packed \((N, 3G)\) field of tiled 3D offsets (e.g. vote offsets). Pair keys=("pos", "normal") to keep positions and normals consistent, or pass box_key to also rotate a \((K, 7)\) oriented-box tensor (centers rotated, heading incremented). Box headings are counterclockwise yaw about the up axis, so box_key requires axis=2.



See Also
torch_pointcloud.transforms.functional.rotate_vectors, torch_pointcloud.transforms.functional.rotate_boxes, torch_pointcloud.transforms.functional.rotation_matrix
Parameters:
-
keys(KeyCollection) βKeys to rotate. Each must be a \((\ldots, 3)\) or \((N, 3G)\) vector field.
-
angle_range(Tuple[float, float], default:(-180.0, 180.0)) βMin and max rotation angle, in degrees.
-
axis(int, default:2) βAxis index to rotate around (0=X, 1=Y, 2=Z).
-
p(float, default:1.0) βProbability of applying the transform.
-
box_key(Optional[str], default:None) βOptional key of a \((K, 7)\) oriented-box tensor to rotate jointly (requires
axis=2); a \((K, 9)\) tensor carries a planar velocity in its last two columns, rotated with the boxes. -
center(Union[str, Sequence[float]], default:'origin') βPoint the rotation is about:
"origin","bbox"(the midrange of the first key),"centroid"(its mean) or an explicit \((x, y, z)\). -
vector_keys(Optional[KeyCollection], default:None) βDirection fields (normals) rotated without the recentering, whatever
centeris. -
dst_keys(Optional[KeyCollection], default:None) βWhere to store the rotated tensors. Defaults to
keys(in-place). -
dst_box_key(Optional[str], default:None) βWhere to store the rotated boxes. Defaults to
box_key(in-place). -
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
RandomScale [source] ΒΆ
RandomScale(
keys: KeyCollection,
scale_range: Tuple[float, float] = (0.8, 1.25),
anisotropic: bool = False,
axes: Optional[Sequence[int]] = None,
p: float = 1.0,
box_key: Optional[str] = None,
dst_keys: Optional[KeyCollection] = None,
dst_box_key: Optional[str] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Scale one or more keys (and optionally oriented boxes) by a uniformly random factor.
Sampling is done once per call: every listed key and the optional box are scaled by the same factor (or per-axis factor vector when anisotropic=True). Pass box_key to also scale a \((K, 7)\) oriented-box tensor (centers and sizes). An oriented box has no per-axis scale, so box_key is incompatible with anisotropic=True.
List only point-like keys. Do not list direction vectors such as normal: a scaled normal is no longer unit length, while a true surface normal is unchanged by an isotropic scale (and an anisotropic scale would require the inverse-transpose rule). Simply omit normal keys.


See Also
torch_pointcloud.transforms.functional.scale_boxes
Parameters:
-
keys(KeyCollection) βKeys to scale. Point-like keys only; do not list direction vectors such as
normal. -
scale_range(Tuple[float, float], default:(0.8, 1.25)) βMin and max scaling factor.
-
anisotropic(bool, default:False) βIf
True, sample a separate scale per axis of the last dim (incompatible withbox_key). -
axes(Optional[Sequence[int]], default:None) βChannels of the last dim that receive the factor, the others keep their values;
Nonescales them all (incompatible withanisotropicandbox_key). -
p(float, default:1.0) βProbability of applying the transform.
-
box_key(Optional[str], default:None) βOptional key of a \((K, 7)\) oriented-box tensor to scale jointly; a \((K, 9)\) tensor carries a planar velocity in its last two columns, scaled with the boxes.
-
dst_keys(Optional[KeyCollection], default:None) βWhere to store the scaled tensors.
-
dst_box_key(Optional[str], default:None) βWhere to store the scaled boxes. Defaults to
box_key(in-place). -
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
RandomFlip [source] ΒΆ
RandomFlip(
keys: KeyCollection,
axes: Sequence[int] = (0, 1),
p: float = 0.5,
box_key: Optional[str] = None,
dst_keys: Optional[KeyCollection] = None,
dst_box_key: Optional[str] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Flip listed axes (and optionally oriented boxes) with probability p each.
Sampling is done once per call: every listed key and the optional box are flipped on the same axes. Each key is a \((\ldots, 3)\) field or a packed \((N, 3G)\) field of tiled 3D offsets (e.g. vote offsets). Pass box_key to also flip a \((K, 7)\) oriented-box tensor (centers negated, heading remapped).



See Also
torch_pointcloud.transforms.functional.flip_vectors, torch_pointcloud.transforms.functional.flip_boxes
Parameters:
-
keys(KeyCollection) βKeys to flip. Each must be a \((\ldots, 3)\) or \((N, 3G)\) vector field.
-
axes(Sequence[int], default:(0, 1)) βAxis indices (into each 3D triple) to consider for flipping.
-
p(float, default:0.5) βPer-axis flip probability.
-
box_key(Optional[str], default:None) βOptional key of a \((K, 7)\) oriented-box tensor to flip jointly; a \((K, 9)\) tensor carries a planar velocity in its last two columns, flipped with the boxes.
-
dst_keys(Optional[KeyCollection], default:None) βWhere to store the flipped tensors.
-
dst_box_key(Optional[str], default:None) βWhere to store the flipped boxes. Defaults to
box_key(in-place). -
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
RandomJitter [source] ΒΆ
RandomJitter(
keys: KeyCollection,
sigma: float = 0.01,
clip: Optional[float] = 0.05,
p: float = 1.0,
dst_keys: Optional[KeyCollection] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Add Gaussian noise to listed keys, optionally clipped.
Each key gets its own independent noise tensor (because the noise shape matches the key shape). Pair-rotation-style consistency does not apply here.


See Also
torch_pointcloud.transforms.functional.random_jitter
Parameters:
-
keys(KeyCollection) βKeys to jitter.
-
sigma(float, default:0.01) βStandard deviation of the Gaussian noise.
-
clip(Optional[float], default:0.05) βIf not
None, clip the noise to[-clip, clip]. -
p(float, default:1.0) βProbability of applying the transform.
-
dst_keys(Optional[KeyCollection], default:None) βWhere to store the jittered tensors.
-
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
RandomTranslate [source] ΒΆ
RandomTranslate(
keys: KeyCollection,
translation_range: Tuple[float, float] = (-0.2, 0.2),
p: float = 1.0,
box_key: Optional[str] = None,
dst_keys: Optional[KeyCollection] = None,
dst_box_key: Optional[str] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Translate listed keys (and optionally oriented boxes) by a uniformly random vector.
Sampling is done once per call: all listed keys and the optional box are shifted by the same translation vector. Pass box_key to also translate a \((K, 7)\) oriented-box tensor (centers only; sizes and heading unchanged).
List only point-like keys. Do not list direction vectors such as normal: directions are translation-invariant, so a shifted normal is wrong. Simply omit normal keys.


See Also
torch_pointcloud.transforms.functional.translate_boxes
Parameters:
-
keys(KeyCollection) βKeys to translate. Point-like keys only; do not list direction vectors such as
normal. -
translation_range(Tuple[float, float], default:(-0.2, 0.2)) βMin and max per-axis translation.
-
p(float, default:1.0) βProbability of applying the transform.
-
box_key(Optional[str], default:None) βOptional key of a \((K, 7)\) oriented-box tensor to translate jointly.
-
dst_keys(Optional[KeyCollection], default:None) βWhere to store the shifted tensors.
-
dst_box_key(Optional[str], default:None) βWhere to store the shifted boxes. Defaults to
box_key(in-place). -
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
RandomColorJitter [source] ΒΆ
RandomColorJitter(
keys: KeyCollection,
brightness: float = 0.4,
contrast: float = 0.4,
saturation: float = 0.2,
int_color: bool = False,
p: float = 1.0,
dst_keys: Optional[KeyCollection] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Jitter colors by brightness, contrast, and saturation strengths.
Each strength is a relative delta uniformly sampled from [-x, x]. Sampling is once per call, so the same factors are applied to every listed key.

See Also
torch_pointcloud.transforms.functional.color_jitter
Parameters:
-
keys(KeyCollection) βColor keys to jitter, shape \((N, 3)\).
-
brightness(float, default:0.4) βMax relative brightness change in \([0, 1]\).
-
contrast(float, default:0.4) βMax relative contrast change in \([0, 1]\).
-
saturation(float, default:0.2) βMax relative saturation change in \([0, 1]\).
-
int_color(bool, default:False) βIf
True, treat float colors as[0, 255]values; otherwise[0, 1].uint8colors are always treated as[0, 255]regardless of the flag; float colors above 1 withint_color=Falseraise a ValueError. -
p(float, default:1.0) βProbability of applying the transform.
-
dst_keys(Optional[KeyCollection], default:None) βWhere to store the jittered tensors.
-
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
RandomColorDrop [source] ΒΆ
RandomColorDrop(
keys: KeyCollection,
fill: float = 0.5,
int_color: bool = False,
p: float = 0.2,
dst_keys: Optional[KeyCollection] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Replace colors with a constant gray value with probability p.

See Also
torch_pointcloud.transforms.functional.color_drop
Parameters:
-
keys(KeyCollection) βColor keys to drop.
-
fill(float, default:0.5) βReplacement value in the range implied by
int_color([0, 1]whenFalse,[0, 255]whenTrue); rescaled to the input's actual range when that differs, so the default0.5fills127onuint8colors. -
int_color(bool, default:False) βIf
True, treat float colors as[0, 255]values; otherwise[0, 1].uint8colors are always treated as[0, 255]regardless of the flag; float colors above 1 withint_color=Falseraise a ValueError. -
p(float, default:0.2) βProbability of dropping colors.
-
dst_keys(Optional[KeyCollection], default:None) βWhere to store the result.
-
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
RandomColorGrayScale [source] ΒΆ
RandomColorGrayScale(
keys: KeyCollection,
int_color: bool = False,
p: float = 0.2,
dst_keys: Optional[KeyCollection] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Convert listed color keys to grayscale (BT.601 luminance) with probability p.

See Also
torch_pointcloud.transforms.functional.color_grayscale
Parameters:
-
keys(KeyCollection) βColor keys, shape \((N, 3)\).
-
int_color(bool, default:False) βIf
True, treat colors as[0, 255]ints; otherwise[0, 1]floats. -
p(float, default:0.2) βProbability of converting to grayscale.
-
dst_keys(Optional[KeyCollection], default:None) βWhere to store the result.
-
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
RandomColorAutoContrast [source] ΒΆ
RandomColorAutoContrast(
keys: KeyCollection,
blend: Optional[float] = 0.5,
int_color: bool = False,
p: float = 0.2,
dst_keys: Optional[KeyCollection] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Stretch per-cloud color range to the full extent, then blend back, with probability p.

See Also
torch_pointcloud.transforms.functional.color_auto_contrast
Parameters:
-
keys(KeyCollection) βColor keys, shape \((N, 3)\).
-
blend(Optional[float], default:0.5) βBlend weight in
[0, 1].1.0is fully auto-contrasted;0.0is the input;Nonedraws a uniform weight on every application. -
int_color(bool, default:False) βIf
True, treat float colors as[0, 255]values; otherwise[0, 1].uint8colors are always treated as[0, 255]regardless of the flag; float colors above 1 withint_color=Falseraise a ValueError. -
p(float, default:0.2) βProbability of applying the transform.
-
dst_keys(Optional[KeyCollection], default:None) βWhere to store the result.
-
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
RandomRotateChoice [source] ΒΆ
RandomRotateChoice(
keys: KeyCollection,
angles: Sequence[float],
axis: int = 2,
p: float = 1.0,
dst_keys: Optional[KeyCollection] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Rotate one or more keys by an angle chosen uniformly from a discrete list.
Common use: ModelNet / ScanObjectNN augmentation with angles=[0, 90, 180, 270] around the z-axis. Sampling is done once per call: every listed key gets the same rotation matrix.
See Also
torch_pointcloud.transforms.functional.rotation_matrix, torch_pointcloud.transforms.functional.rotate_vectors


Parameters:
-
keys(KeyCollection) βKeys to rotate. Each must have shape
(..., 3). -
angles(Sequence[float]) βCandidate rotation angles, in degrees. Must be non-empty.
-
axis(int, default:2) βAxis index to rotate around (0=X, 1=Y, 2=Z).
-
p(float, default:1.0) βProbability of applying the transform.
-
dst_keys(Optional[KeyCollection], default:None) βWhere to store the rotated tensors. Defaults to
keys(in-place). -
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
RandomColorShift [source] ΒΆ
RandomColorShift(
keys: KeyCollection,
shift_range: Tuple[float, float] = (-0.05, 0.05),
int_color: bool = False,
p: float = 1.0,
dst_keys: Optional[KeyCollection] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Additive per-channel color shift sampled uniformly per channel.
For each of the 3 channels, sample one offset uniformly from shift_range and add it to every point's value. Sampling is once per call (same shift across all listed keys). Result is clamped to the valid color range.

See Also
torch_pointcloud.transforms.functional.color_shift
Parameters:
-
keys(KeyCollection) βColor keys to shift, shape \((N, 3)\).
-
shift_range(Tuple[float, float], default:(-0.05, 0.05)) βMin and max per-channel offset (in the same range as the colors).
-
int_color(bool, default:False) βIf
True, treat float colors as[0, 255]values; otherwise[0, 1].uint8colors are always treated as[0, 255]regardless of the flag; float colors above 1 withint_color=Falseraise a ValueError. -
p(float, default:1.0) βProbability of applying the transform.
-
dst_keys(Optional[KeyCollection], default:None) βWhere to store the shifted tensors.
-
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
RandomElasticDistortion [source] ΒΆ
RandomElasticDistortion(
keys: KeyCollection,
granularity: Union[float, Sequence[float]] = 0.2,
magnitude: Union[float, Sequence[float]] = 0.4,
p: float = 1.0,
dst_keys: Optional[KeyCollection] = None,
seed: Optional[int] = None,
allow_missing_keys: bool = False,
)
Bases: DictTransform, Randomizable
Apply a smooth random displacement field (elastic distortion).
Used in sparse-voxel indoor segmentation recipes. Sampling is done once per call so multi-key consistency is preserved (the same displacement field is applied to every listed key).
For multi-scale distortion (the common default), compose two RandomElasticDistortion calls with different granularity / magnitude.


See Also
torch_pointcloud.transforms.functional.random_elastic_distortion
Parameters:
-
keys(KeyCollection) βPosition keys to distort, shape \((N, 3)\). All listed keys must share the same leading dimension \(N\): the per-point displacement is computed once from the first present key and added to every key.
-
granularity(Union[float, Sequence[float]], default:0.2) βSize of the displacement-field grid cells. Smaller values give higher-frequency distortion. Several values (paired with
magnitude) run one pass each, under the same probability gate. -
magnitude(Union[float, Sequence[float]], default:0.4) βStandard deviation of the per-cell Gaussian noise. Larger values give stronger deformation.
-
p(float, default:1.0) βProbability of applying the transform.
-
dst_keys(Optional[KeyCollection], default:None) βWhere to store the distorted tensors.
-
seed(Optional[int], default:None) βSeed of the transform's own random stream;
Nonedraws from the global generator (seeRandomizable). -
allow_missing_keys(bool, default:False) βIf
True, silently skip absent keys.
rotate_boxes [source] ΒΆ
Rotate oriented 3D boxes about the up axis.
Box centers are rotated by rotation (centers @ rotation.transpose(-1, -2)) and the heading is incremented by angle, so a counterclockwise rotation about \(+z\) keeps the counterclockwise heading aligned with the jointly rotated points. Sizes are unchanged. Boxes with a planar velocity \((v_x, v_y)\) in columns \(7{:}9\) have it rotated in the plane; further columns are kept as they are.
Parameters:
-
boxes(Tensor) βBox tensor of shape \((K, 7)\) as \([c_x, c_y, c_z, d_x, d_y, d_z, \theta]\), or \((K, 7 + C)\).
-
rotation(Tensor) βA \(3 \times 3\) rotation matrix rotating by
anglecounterclockwise about the \(z\) axis. -
angle(float) βRotation angle in radians, added to the heading.
Returns:
-
TensorβThe rotated box tensor, same shape as
boxes.
scale_boxes [source] ΒΆ
Scale oriented 3D boxes by an isotropic factor.
Both centers and extents (columns \(0\) to \(6\)) are multiplied by scale, and so is a planar velocity \((v_x, v_y)\) in columns \(7{:}9\). Heading and further columns are unchanged.
Parameters:
-
boxes(Tensor) βBox tensor of shape \((K, 7)\) or \((K, 7 + C)\).
-
scale(Union[float, Tensor]) βIsotropic scalar factor applied to centers, sizes and velocity.
Returns:
-
TensorβThe scaled box tensor, same shape as
boxes.
flip_boxes [source] ΒΆ
Flip oriented 3D boxes along a spatial axis.
Boxes are stored as \((K, 7)\) rows \([c_x, c_y, c_z, d_x, d_y, d_z, \theta]\) with full extents and heading in radians counterclockwise about \(+z\) from \(+x\). A flip negates the center component along axis. A flip along axis \(0\) (the \(yz\) plane) maps the heading to \(\pi - \theta\); a flip along axis \(1\) (the \(xz\) plane) maps the heading to \(-\theta\). Sizes are unchanged. Boxes with a planar velocity \((v_x, v_y)\) in columns \(7{:}9\) have its axis component negated too; further columns are kept as they are.
Parameters:
-
boxes(Tensor) βBox tensor of shape \((K, 7)\) or \((K, 7 + C)\).
-
axis(int) βCenter axis index to negate (0=X, 1=Y).
Returns:
-
TensorβThe flipped box tensor, same shape as
boxes.
flip_vectors [source] ΒΆ
Flip a packed field of 3D vectors along a spatial axis.
Negates component axis of every contiguous triple of the last dimension, so it handles both a plain \((N, 3)\) field (e.g. coordinates or normals) and a \((N, 3 G)\) field of \(G\) tiled offsets (e.g. vote offsets \((\text{center} - \text{point})\)) alike.
Parameters:
-
x(Tensor) βVector field of shape \((N, 3)\) or \((N, 3 G)\).
-
axis(int) βAxis index within each triple to negate.
Returns:
-
TensorβThe flipped tensor with the same shape as
x.
random_jitter [source] ΒΆ
random_jitter(
x: Tensor,
sigma: float = 0.01,
clip: Optional[float] = 0.05,
generator: Optional[Generator] = None,
) -> Tensor
Add Gaussian noise to x, optionally clipped.
Parameters:
-
x(Tensor) βInput tensor.
-
sigma(float, default:0.01) βStandard deviation of the Gaussian noise.
-
clip(Optional[float], default:0.05) βIf not
None, clip the noise to[-clip, clip]. -
generator(Optional[Generator], default:None) βRandom generator for reproducibility.
Returns:
-
TensorβJittered tensor with the same shape as
x.
translate_boxes [source] ΒΆ
Translate oriented 3D boxes by a fixed offset.
Centers (columns \(0\) to \(3\)) are offset by translation. Sizes, heading and any further column (such as a velocity) are unchanged.
Parameters:
-
boxes(Tensor) βBox tensor of shape \((K, 7)\) as \([c_x, c_y, c_z, d_x, d_y, d_z, \theta]\), or \((K, 7 + C)\).
-
translation(Tensor) βTranslation vector of shape \((3,)\).
Returns:
-
TensorβThe shifted box tensor, same shape as
boxes.
color_jitter [source] ΒΆ
color_jitter(
color: Tensor,
brightness: Optional[float] = None,
contrast: Optional[float] = None,
saturation: Optional[float] = None,
int_color: bool = False,
) -> Tensor
Apply brightness, contrast, and saturation factors to colors, in that order.
Each factor multiplies its component directly (1.0 is identity); None skips the component entirely.
Parameters:
-
color(Tensor) βColor tensor of shape \((N, 3)\).
-
brightness(Optional[float], default:None) βMultiplicative brightness factor (e.g.
1.2brightens by 20%). -
contrast(Optional[float], default:None) βContrast factor, scaling the deviation from the per-channel mean.
-
saturation(Optional[float], default:None) βSaturation factor, scaling the deviation from the per-point grayscale luminance.
-
int_color(bool, default:False) βIf
True, treat float colors as[0, 255]values; otherwise[0, 1].uint8colors are always treated as[0, 255]regardless of the flag.
Returns:
-
TensorβJittered colors with the same shape and dtype as
color.
Raises:
-
ValueErrorβIf
coloris a float tensor with values above 1 whileint_color=False.
random_color_jitter [source] ΒΆ
random_color_jitter(
color: Tensor,
brightness: float = 0.0,
contrast: float = 0.0,
saturation: float = 0.0,
int_color: bool = False,
generator: Optional[Generator] = None,
) -> Tensor
Jitter colors by brightness, contrast, and saturation, in that order.
Each strength is a relative delta sampled uniformly from [-x, x] and applied multiplicatively (out = x * factor) via color_jitter.
Parameters:
-
color(Tensor) βColor tensor of shape \((N, 3)\).
-
brightness(float, default:0.0) βMax relative brightness change.
0.2means Β±20%. -
contrast(float, default:0.0) βMax relative contrast change.
-
saturation(float, default:0.0) βMax relative saturation change. Saturation moves toward (or away from) the per-channel grayscale luminance.
-
int_color(bool, default:False) βIf
True, treat float colors as[0, 255]values; otherwise[0, 1].uint8colors are always treated as[0, 255]regardless of the flag. -
generator(Optional[Generator], default:None) βRandom generator for reproducibility.
Returns:
-
TensorβJittered colors with the same shape and dtype as
color.
Raises:
-
ValueErrorβIf
coloris a float tensor with values above 1 whileint_color=False.
color_drop [source] ΒΆ
Replace colors with a constant gray value (drops chromatic information).
Parameters:
-
color(Tensor) βColor tensor of shape \((N, 3)\).
-
fill(float, default:0.5) βReplacement value, expressed in the range implied by
int_color([0, 1]whenFalse,[0, 255]whenTrue). It is rescaled to the input's actual range when that differs, so the default0.5fills127onuint8colors. -
int_color(bool, default:False) βIf
True, treat float colors as[0, 255]values; otherwise[0, 1].uint8colors are always treated as[0, 255]regardless of the flag.
Returns:
-
TensorβTensor of the same shape and dtype as
color, filled with the rescaledfill.
Raises:
-
ValueErrorβIf
coloris a float tensor with values above 1 whileint_color=False.
color_grayscale [source] ΒΆ
Convert RGB colors to grayscale using the BT.601 luminance weights.
Parameters:
-
color(Tensor) βColor tensor of shape \((N, 3)\).
-
int_color(bool, default:False) βIf
True, treat colors as[0, 255]ints; otherwise[0, 1]floats.
Returns:
-
TensorβTensor with the same shape and dtype as
color, with R=G=B = luminance.
color_auto_contrast [source] ΒΆ
Stretch per-cloud color range to the full [0, max] interval, then blend.
For each channel, the min becomes 0 and the max becomes max_val. The output is then linearly blended with the original by blend (blend=1.0 is the fully stretched version, blend=0.0 is the input).
Parameters:
-
color(Tensor) βColor tensor of shape \((N, 3)\).
-
blend(float, default:0.5) βBlend weight in
[0, 1]. -
int_color(bool, default:False) βIf
True, treat float colors as[0, 255]values; otherwise[0, 1].uint8colors are always treated as[0, 255]regardless of the flag.
Returns:
-
TensorβAuto-contrast tensor with the same shape and dtype as
color.
Raises:
-
ValueErrorβIf
coloris a float tensor with values above 1 whileint_color=False.
color_shift [source] ΒΆ
Add a per-channel offset to colors, clamped to the valid color range.
Parameters:
-
color(Tensor) βColor tensor of shape \((N, 3)\).
-
shift(Tensor) βPer-channel offset of shape \((3,)\), in the same range as the colors.
-
int_color(bool, default:False) βIf
True, treat float colors as[0, 255]values; otherwise[0, 1].uint8colors are always treated as[0, 255]regardless of the flag.
Returns:
-
TensorβShifted colors with the same shape and dtype as
color.
Raises:
-
ValueErrorβIf
coloris a float tensor with values above 1 whileint_color=False.
random_elastic_distortion [source] ΒΆ
random_elastic_distortion(
pos: Tensor,
granularity: float = 0.2,
magnitude: float = 0.4,
generator: Optional[Generator] = None,
) -> Tensor
Apply a smooth random displacement field to pos.
Implements the elastic distortion recipe common in sparse-voxel indoor segmentation pipelines: sample Gaussian noise on a coarse 3D grid (cells of side granularity), smooth it with two passes of a \(3 \times 3 \times 3\) mean filter, trilinear-interpolate the smoothed displacement at each point, and add it to the position. Net effect is a locally-coherent, low-frequency deformation that preserves nearby-point relationships.
Parameters:
-
pos(Tensor) βInput positions of shape \((N, 3)\).
-
granularity(float, default:0.2) βSize of the noise grid cells (in the same units as
pos). Smaller values give higher-frequency distortion. -
magnitude(float, default:0.4) βStandard deviation of the per-cell Gaussian noise (in the same units as
pos). Larger values give stronger deformation. -
generator(Optional[Generator], default:None) βRandom generator for reproducibility.
Returns:
-
TensorβDistorted positions of shape \((N, 3)\).