Class RandomInvert

Inheritance Relationships

Base Type

Class Documentation

class RandomInvert : public mindspore::dataset::TensorTransform

Randomly invert the input image with a given probability.

Public Functions

explicit RandomInvert(float prob = 0.5)

Constructor.

参数

prob[in] A float representing the probability of the image being inverted, which must be in range of 0, 1.

样例
/* Define operations */
auto decode_op = vision::Decode();
auto random_op = vision::RandomInvert(0.8);

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

Destructor.