Class BoundingBoxAugment

Inheritance Relationships

Base Type

Class Documentation

class BoundingBoxAugment : public mindspore::dataset::TensorTransform

BoundingBoxAugment TensorTransform.

Note

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

Public Functions

explicit BoundingBoxAugment(TensorTransform *transform, float ratio = 0.3)

Constructor.

Parameters
  • transform[in] Raw pointer to the TensorTransform operation.

  • ratio[in] Ratio of bounding boxes to apply augmentation on. Range: 0, 1.

样例
/* Define operations */
TensorTransform *rotate_op = new vision::RandomRotation({-180, 180});
auto bbox_aug_op = vision::BoundingBoxAugment(rotate_op, 0.5);

/* dataset is an instance of Dataset object */
dataset = dataset->Map({bbox_aug_op},       // operations
                       {"image", "bbox"});  // input columns
explicit BoundingBoxAugment(const std::shared_ptr<TensorTransform> &transform, float ratio = 0.3)

Constructor.

Parameters
  • transform[in] Smart pointer to the TensorTransform operation.

  • ratio[in] Ratio of bounding boxes where augmentation is applied to. Range: 0, 1.

样例
/* Define operations */
std::shared_ptr<TensorTransform> flip_op = std::make_shared<vision::RandomHorizontalFlip>(0.5);
std::shared_ptr<TensorTransform> bbox_aug_op = std::make_shared<vision::BoundingBoxAugment>(flip_op, 0.1);

/* dataset is an instance of Dataset object */
dataset = dataset->Map({bbox_aug_op},       // operations
                       {"image", "bbox"});  // input columns
explicit BoundingBoxAugment(const std::reference_wrapper<TensorTransform> &transform, float ratio = 0.3)

Constructor.

Parameters
  • transform[in] Object pointer to the TensorTransform operation.

  • ratio[in] Ratio of bounding boxes where augmentation is applied to. Range: 0, 1.

样例
/* Define operations */
vision::RandomColor random_color_op = vision::RandomColor(0.5, 1.0);
vision::BoundingBoxAugment bbox_aug_op = vision::BoundingBoxAugment(random_color_op, 0.8);

/* dataset is an instance of Dataset object */
dataset = dataset->Map({bbox_aug_op},       // operations
                       {"image", "bbox"});  // input columns
~BoundingBoxAugment() = default

Destructor.