RandomBBoxCrop

class dragon.vm.dali.ops.RandomBBoxCrop(
  scaling=0.3, 1.0,
  aspect_ratio=0.5, 2.0,
  thresholds=0.0, 0.1, 0.3, 0.5, 0.7, 0.9,
  allow_no_crop=True,
  num_attempts=10,
  bbox_layout='xyXY',
  **kwargs
)[source]

Return an valid image crop restricted by bounding boxes.

Examples:

bbox_crop = dali.ops.RandomBBoxCrop(
    # Range of scale
    scaling=[0.3, 1.0],
    # Range of aspect ratio
    aspect_ratio=[0.5, 2.0],
    # Minimum IoUs to satisfy
    thresholds=[0.0, 0.1, 0.3, 0.5, 0.7, 0.9],
)
crop_begin, crop_size, bbox, label = bbox_crop(inputs['bbox'], inputs['label'])

__new__

static RandomBBoxCrop.__new__(
  cls,
  scaling=0.3, 1.0,
  aspect_ratio=0.5, 2.0,
  thresholds=0.0, 0.1, 0.3, 0.5, 0.7, 0.9,
  allow_no_crop=True,
  num_attempts=10,
  bbox_layout='xyXY',
  **kwargs
)[source]

Create a RandomBBoxCrop operator.

Parameters:
  • scaling (Sequence[float], optional, default=(0.3, 1.0)) – The range of scale for sampling regions.
  • aspect_ratio (Sequence[float], optional, default=(0.5, 2.0)) – The range of aspect ratio for sampling regions.
  • thresholds (Sequence[float], optional) – The minimum IoU(s) to satisfy.
  • allow_no_crop (bool, optional, default=True) – True to include the no-cropping as an option.
  • num_attempts (int, optional, default=10) – The max number of sampling trails.
  • bbox_layout (str, optional, default='xyXY') – The optional bbox layout.
Returns:

nvidia.dali.ops.RandomBBoxCrop – The operator.