nvidia.dali.fn.gaussian_blur

nvidia.dali.fn.gaussian_blur(*inputs, **kwargs)

Applies a Gaussian Blur to the input.

Gaussian blur is calculated by applying a convolution with a Gaussian kernel, which can be parameterized with windows_size and sigma. If only the sigma is specified, the radius of the Gaussian kernel defaults to ceil(3 * sigma), so the kernel window size is 2 * ceil(3 * sigma) + 1.

If only the window size is provided, the sigma is calculated by using the following formula:

radius = (window_size - 1) / 2
sigma = (radius - 1) * 0.3 + 0.8

The sigma and kernel window size can be specified as one value for all data axes or a value per data axis.

When specifying the sigma or window size per axis, the axes are provided same as layouts, from outermost to innermost.

Note

The channel C and frame F dimensions are not considered data axes. If channels are present, only channel-first or channel-last inputs are supported.

For example, with HWC input, you can provide sigma=1.0 or sigma=(1.0, 2.0) because there are two data axes, H and W.

The same input can be provided as per-sample tensors.

This operator allows sequence inputs and supports volumetric data.

Supported backends
  • ‘cpu’

  • ‘gpu’

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.

  • dtype (nvidia.dali.types.DALIDataType, optional, default = DALIDataType.NO_TYPE) –

    Output data type.

    Supported type: FLOAT. If not set, the input type is used.

  • 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.

  • sigma (float or list of float or TensorList of float, optional, default = [0.0]) –

    Sigma value for the Gaussian Kernel.

    Supports per-frame inputs.

  • window_size (int or list of int or TensorList of int, optional, default = [0]) –

    The diameter of the kernel.

    Supports per-frame inputs.