RandomResizedCrop

class dragon.vm.dali.ops.RandomResizedCrop(
  size,
  interp_type=None,
  mag_filter=None,
  min_filter=None,
  random_area=0.08, 1.0,
  random_aspect_ratio=0.75, 1.33,
  num_attempts=10,
  **kwargs
)[source]

Return a resized random crop of image.

Examples:

resize = dali.ops.RandomResizedCrop(
    size=(224, 224),
    # Inception sampling policy for image classification
    random_area=(0.08, 1.00),
    random_aspect_ratio=(0.75, 1.33),
)
y = resize(inputs['x'])

__new__

static RandomResizedCrop.__new__(
  cls,
  size,
  interp_type=None,
  mag_filter=None,
  min_filter=None,
  random_area=0.08, 1.0,
  random_aspect_ratio=0.75, 1.33,
  num_attempts=10,
  **kwargs
)[source]

Create a ImageDecoderRandomCrop operator.

Parameters:
  • size (Union[int, Sequence[int]]) – The output image size.
  • interp_type (str, optional) – The interpolation for both up and down sampling.
  • mag_filter (str, optional, default='LINEAR') – The interpolation for up sampling.
  • min_filter (str, optional, default='TRIANGULAR') – The interpolation for down sampling.
  • random_area (Sequence[float], optional, default=(0.08, 1.)) – The range of scale for sampling.
  • random_aspect_ratio (Sequence[float], optional, default=(0.75, 1.33)) – The range of aspect ratio for sampling.
  • num_attempts (int, optional, default=10) – The max number of sampling trails.
Returns:

nvidia.dali.ops.ImageDecoderRandomCrop – The operator.