nvidia.dali.experimental.dynamic.jpeg_compression_distortion#

nvidia.dali.experimental.dynamic.jpeg_compression_distortion(input, /, *, batch_size=None, device=None, quality=None)#

Introduces JPEG compression artifacts to RGB images.

JPEG is a lossy compression format which exploits characteristics of natural images and human visual system to achieve high compression ratios. The information loss originates from sampling the color information at a lower spatial resolution than the brightness and from representing high frequency components of the image with a lower effective bit depth. The conversion to frequency domain and quantization is applied independently to 8x8 pixel blocks, which introduces additional artifacts at block boundaries.

This operation produces images by subjecting the input to a transformation that mimics JPEG compression with given quality factor followed by decompression.

This operator allows sequence inputs.

Supported backends
  • ‘cpu’

  • ‘gpu’

Parameters:

input (Tensor/Batch ('HWC', 'FHWC')) – Input to the operator.

Keyword Arguments:

quality (int or Tensor/Batch of int, optional, default = 50) –

JPEG compression quality from 1 (lowest quality) to 100 (highest quality).

Any values outside the range 1-100 will be clamped.