RandomColorDrop#

class RandomColorDrop(p=0.2, color_augment=0.0)[source]#

Bases: object

Randomly drop (zero out or attenuate) per-point color.

With probability p and when "color" is present, multiplies data_dict["color"] by color_augment in place (0.0 drops color entirely), forcing the model not to rely solely on color. Registered as RandomColorDrop — use this string as the type in a transform=[...] config list.

Parameters:
  • p (float) – Probability of dropping color. Defaults to 0.2.

  • color_augment (float) – Multiplier applied to color when dropped (0.0 zeroes it). Defaults to 0.0.

Example

>>> import numpy as np
>>> data = {"color": np.array([[100., 150., 200.]], dtype="f4")}
>>> RandomColorDrop(p=1.0, color_augment=0.0)(data)["color"]
array([[0., 0., 0.]], dtype=float32)  # color zeroed out (dropped)