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 operator 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

>>> # 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
>>> image_folder_dataset = image_folder_dataset.map(operations=[bbox_aug_op],
...                                                 input_columns=["image", "bbox"],
...                                                 output_columns=["image", "bbox"],
...                                                 column_order=["image", "bbox"])