mindspore.dataset.vision.c_transforms.BoundingBoxAugment

class mindspore.dataset.vision.c_transforms.BoundingBoxAugment(transform, ratio=0.3)[source]

Apply a given image transform on a random selection of bounding box regions of a given image.

Parameters
  • transform – C++ transformation function to be applied on random selection of bounding box regions of a given image.

  • ratio (float, optional) – Ratio of bounding boxes to apply augmentation on. Range: [0, 1] (default=0.3).

Examples

>>> import mindspore.dataset.vision.c_transforms as c_vision
>>>
>>> # set bounding box operation with ratio of 1 to apply rotation on all bounding boxes
>>> bbox_aug_op = c_vision.BoundingBoxAugment(c_vision.RandomRotation(90), 1)
>>> # map to apply ops
>>> data3 = data3.map(operations=[bbox_aug_op],
>>>                   input_columns=["image", "bbox"],
>>>                   output_columns=["image", "bbox"],
>>>                   column_order=["image", "bbox"])