RandomColorJitter#
- class RandomColorJitter(brightness=0, contrast=0, saturation=0, hue=0, p=0.95)[source]#
Bases:
objectRandomly jitter brightness, contrast, saturation, and hue of point colors.
A torchvision-style
ColorJitterfor 3D point-cloud"color". Each call draws a random order over the four adjustments and, for each enabled one, applies it with probabilitypusing a factor sampled from the range implied by the constructor argument; modifiesdata_dict["color"]in place. Registered asRandomColorJitter— use this string as thetypein atransform=[...]config list.- Parameters:
brightness (float or tuple) – Either a non-negative magnitude
bgiving the factor range[max(0, 1 - b), 1 + b]or an explicit(min, max)pair.0disables. Defaults to0.contrast (float or tuple) – Same convention as
brightnessfor contrast. Defaults to0.saturation (float or tuple) – Same convention as
brightnessfor saturation. Defaults to0.hue (float or tuple) – Either a magnitude
h(0 <= h <= 0.5) giving the range[-h, h]or an explicit(min, max)within[-0.5, 0.5].0disables. Defaults to0.p (float) – Per-adjustment probability of application. Defaults to
0.95.
Example
>>> import numpy as np >>> np.random.seed(0) >>> data = {"color": np.array([[100., 150., 200.]], dtype="f4")} >>> RandomColorJitter(brightness=0.4, p=1.0)(data)["color"].round(2) array([[103.91, 155.86, 207.81]], dtype=float32) # brightness factor ~1.04 applied