Class RandomAffine
Defined in File vision_lite.h
Inheritance Relationships
Base Type
public mindspore::dataset::TensorTransform
(Class TensorTransform)
Class Documentation
-
class RandomAffine : public mindspore::dataset::TensorTransform
Apply a Random Affine transformation on the input image in RGB or Greyscale mode.
Public Functions
-
explicit RandomAffine(const std::vector<float_t> °rees, const std::vector<float_t> &translate_range = {0.0, 0.0, 0.0, 0.0}, const std::vector<float_t> &scale_range = {1.0, 1.0}, const std::vector<float_t> &shear_ranges = {0.0, 0.0, 0.0, 0.0}, InterpolationMode interpolation = InterpolationMode::kNearestNeighbour, const std::vector<uint8_t> &fill_value = {0, 0, 0})
Constructor.
- Parameters
degrees – [in] A float vector of size 2, representing the starting and ending degree.
translate_range – [in] A float vector of size 2 or 4, representing percentages of translation on x and y axes. If the size is 2, (min_dx, max_dx, 0, 0). If the size is 4, (min_dx, max_dx, min_dy, max_dy), all values are in range [-1, 1].
scale_range – [in] A float vector of size 2, representing the starting and ending scales in the range.
shear_ranges – [in] A float vector of size 2 or 4, representing the starting and ending shear degrees vertically and horizontally. If the size is 2, (min_shear_x, max_shear_x, 0, 0), if the size is 4, (min_shear_x, max_shear_x, min_shear_y, max_shear_y).
interpolation – [in] An enum for the mode of interpolation.
InterpolationMode::kLinear, Interpolation method is blinear interpolation (Only supports this mode in Lite).
InterpolationMode::kNearestNeighbour, Interpolation method is nearest-neighbor interpolation.
InterpolationMode::kCubic, Interpolation method is bicubic interpolation.
InterpolationMode::kArea, Interpolation method is pixel area interpolation.
fill_value – [in] A vector representing the value to fill the area outside the transform in the output image. If 1 value is provided, it is used for all RGB channels. If 3 values are provided, it is used to fill R, G and B channels respectively.
Example/* Define operations */ auto decode_op = vision::Decode(); auto random_op = vision::RandomAffine({45, 90}); /* dataset is an instance of Dataset object */ dataset = dataset->Map({decode_op, random_op}, // operations {"image"}); // input columns
-
~RandomAffine() = default
Destructor.
-
virtual std::shared_ptr<TensorOperation> Parse() override
The function to convert a TensorTransform object into a TensorOperation object.
- Returns
Shared pointer to TensorOperation object.
-
explicit RandomAffine(const std::vector<float_t> °rees, const std::vector<float_t> &translate_range = {0.0, 0.0, 0.0, 0.0}, const std::vector<float_t> &scale_range = {1.0, 1.0}, const std::vector<float_t> &shear_ranges = {0.0, 0.0, 0.0, 0.0}, InterpolationMode interpolation = InterpolationMode::kNearestNeighbour, const std::vector<uint8_t> &fill_value = {0, 0, 0})