Class UniformAugment

Inheritance Relationships

Base Type

Class Documentation

class UniformAugment : public mindspore::dataset::TensorTransform

Randomly perform transformations, as selected from input transform list, on the input tensor.

Public Functions

explicit UniformAugment(const std::vector<TensorTransform*> &transforms, int32_t num_ops = 2)

Constructor.

Parameters
  • transforms[in] Raw pointer to vector of TensorTransform operations.

  • num_ops[in] An integer representing the number of operations to be selected and applied.

样例
/* Define operations */
auto resize_op(new vision::Resize({30, 30}));
auto random_crop_op(new vision::RandomCrop({28, 28}));
auto center_crop_op(new vision::CenterCrop({16, 16}));
auto uniform_op(new vision::UniformAugment({random_crop_op, center_crop_op}, 2));

/* dataset is an instance of Dataset object */
dataset = dataset->Map({resize_op, uniform_op},  // operations
                       {"image"});               // input columns
explicit UniformAugment(const std::vector<std::shared_ptr<TensorTransform>> &transforms, int32_t num_ops = 2)

Constructor.

Parameters
  • transforms[in] Smart pointer to vector of TensorTransform operations.

  • num_ops[in] An integer representing the number of operations to be selected and applied.

样例
/* Define operations */
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({30, 30}));
std::shared_ptr<TensorTransform> random_crop_op(new vision::RandomCrop({28, 28}));
std::shared_ptr<TensorTransform> center_crop_op(new vision::CenterCrop({16, 16}));
std::shared_ptr<TensorTransform> uniform_op(new vision::UniformAugment({random_crop_op, center_crop_op}, 2));

/* dataset is an instance of Dataset object */
dataset = dataset->Map({resize_op, uniform_op},  // operations
                       {"image"});               // input columns
explicit UniformAugment(const std::vector<std::reference_wrapper<TensorTransform>> &transforms, int32_t num_ops = 2)

Constructor.

Parameters
  • transforms[in] Object pointer to vector of TensorTransform operations.

  • num_ops[in] An integer representing the number of operations to be selected and applied.

样例
/* Define operations */
vision::Resize resize_op = vision::Resize({30, 30});
vision::RandomCrop random_crop_op = vision::RandomCrop({28, 28});
vision::CenterCrop center_crop_op = vision::CenterCrop({16, 16});
vision::UniformAugment uniform_op = vision::UniformAugment({random_crop_op, center_crop_op}, 2);

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

Destructor.