nvidia.dali.experimental.dynamic.segmentation.random_mask_pixel#

nvidia.dali.experimental.dynamic.segmentation.random_mask_pixel(input, /, *, batch_size=None, device=None, foreground=None, seed=None, threshold=None, value=None, rng=None)#

Selects random pixel coordinates in a mask, sampled from a uniform distribution.

Based on run-time argument foreground, it returns either only foreground pixels or any pixels.

Pixels are classified as foreground either when their value exceeds a given threshold or when it’s equal to a specific value.

Supported backends
  • ‘cpu’

Parameters:

input (Tensor/Batch) – Input to the operator.

Keyword Arguments:
  • foreground (int or Tensor/Batch of int, optional, default = 0) –

    If different than 0, the pixel position is sampled uniformly from all foreground pixels.

    If 0, the pixel position is sampled uniformly from all available pixels.

  • threshold (float or Tensor/Batch of float, optional, default = 0.0) –

    All pixels with a value above this threshold are interpreted as foreground.

    This argument is mutually exclusive with value argument.

  • value (int or Tensor/Batch of int, optional) –

    All pixels equal to this value are interpreted as foreground.

    This argument is mutually exclusive with threshold argument and is meant to be used only with integer inputs.

  • rng (RNG, optional) – A random number generator instance. Can be obtained by calling nvidia.dali.experimental.dynamic.random.RNG(seed)(). If not provided, the default RNG is used.