RandomBBoxCrop

class dragon.vm.dali.ops.RandomBBoxCrop[source]

Return a valid 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,
  ltrb=True,
  num_attempts=10
)[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 a option.
  • ltrb (bool, optional, default=True) – Indicate the bbox is ltrb or xywh format.
  • num_attempts (int, optional, default=10) – The max number of sampling trails.
Returns:

nvidia.dali.ops.RandomBBoxCrop – The operator.