nvidia.dali.fn.segmentation.random_mask_pixel#

nvidia.dali.fn.segmentation.random_mask_pixel(
__input,
/,
*,
bytes_per_sample_hint=[0],
foreground=0,
preserve=False,
seed=-1,
threshold=0.0,
value=None,
device=None,
name=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 (TensorList) – Input to the operator.

Keyword Arguments:
  • bytes_per_sample_hint (int or list of int, optional, default = [0]) –

    Output size hint, in bytes per sample.

    If specified, the operator’s outputs residing in GPU or page-locked host memory will be preallocated to accommodate a batch of samples of this size.

  • foreground (int or TensorList 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.

  • preserve (bool, optional, default = False) – Prevents the operator from being removed from the graph even if its outputs are not used.

  • seed (int, optional, default = -1) –

    Random seed.

    If not provided, it will be populated based on the global seed of the pipeline.

  • threshold (float or TensorList 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 TensorList 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.