mindspore.dataset.vision.BoundingBoxAugment

class mindspore.dataset.vision.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) – 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 an image processing operation in mindspore.dataset.vision.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 = vision.BoundingBoxAugment(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"])