mindspore.dataset.vision.c_transforms.BoundingBoxAugment

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

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

Parameters
  • transform (TensorOperation) – C++ transformation operation 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.0, 1.0] (default=0.3).

Raises
  • TypeError – If transform is not an image processing operation in mindspore.dataset.vision.c_transforms.

  • TypeError – If ratio is not of type float.

  • ValueError – If ratio is not in range [0.0, 1.0].

  • RuntimeError – If given bounding box is invalid.

Supported Platforms:

CPU

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"])