nvidia.dali.experimental.dynamic.random_resized_crop#
- nvidia.dali.experimental.dynamic.random_resized_crop(input, /, *, batch_size=None, device=None, antialias=None, dtype=None, interp_type=None, mag_filter=None, min_filter=None, minibatch_size=None, num_attempts=None, random_area=None, random_aspect_ratio=None, seed=None, size, temp_buffer_hint=None, rng=None)#
Performs a crop with a randomly selected area and aspect ratio and resizes it to the specified size.
Expects a three-dimensional input with samples in height, width, channels (HWC) layout.
This operator allows sequence inputs.
- Supported backends
‘cpu’
‘gpu’
- Parameters:
input¶ (Tensor/Batch ('HWC', 'CHW', 'FHWC', 'FCHW', 'CFHW')) – Input to the operator.
- Keyword Arguments:
antialias¶ (bool, optional, default = True) –
If enabled, it applies an antialiasing filter when scaling down.
Note
Nearest neighbor interpolation does not support antialiasing.
dtype¶ (
nvidia.dali.types.DALIDataType, optional) –Output data type.
Must be same as input type or
float. If not set, input type is used.interp_type¶ (
nvidia.dali.types.DALIInterpTypeor Tensor/Batch ofnvidia.dali.types.DALIInterpType, optional, default = DALIInterpType.INTERP_LINEAR) –Type of interpolation to be used.
Use
min_filterandmag_filterto specify different filtering for downscaling and upscaling.Note
Usage of INTERP_TRIANGULAR is now deprecated and it should be replaced by a combination of
INTERP_LINEAR with
antialiasenabled.mag_filter¶ (
nvidia.dali.types.DALIInterpTypeor Tensor/Batch ofnvidia.dali.types.DALIInterpType, optional, default = DALIInterpType.INTERP_LINEAR) – Filter used when scaling up.min_filter¶ (
nvidia.dali.types.DALIInterpTypeor Tensor/Batch ofnvidia.dali.types.DALIInterpType, optional, default = DALIInterpType.INTERP_LINEAR) – Filter used when scaling down.minibatch_size¶ (int, optional, default = 32) – Maximum number of images that are processed in a kernel call.
num_attempts¶ (int, optional, default = 10) – Maximum number of attempts used to choose random area and aspect ratio.
random_area¶ (float or list of float, optional, default = [0.08, 1.0]) –
Range from which to choose random area fraction
A.The cropped image’s area will be equal to
A* original image’s area.random_aspect_ratio¶ (float or list of float, optional, default = [0.75, 1.333333]) – Range from which to choose random aspect ratio (width/height).
size¶ (int or list of int) – Size of the resized image.
temp_buffer_hint¶ (int, optional, default = 0) –
Initial size in bytes, of a temporary buffer for resampling.
Note
This argument is ignored for the CPU variant.
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.