Class RandomCropDecodeResize

Inheritance Relationships

Base Type

Class Documentation

class RandomCropDecodeResize : public mindspore::dataset::TensorTransform

Equivalent to RandomResizedCrop TensorTransform, but crop the image before decoding.

Public Functions

explicit RandomCropDecodeResize(std::vector<int32_t> size, std::vector<float> scale = {0.08, 1.0}, std::vector<float> ratio = {3. / 4, 4. / 3}, InterpolationMode interpolation = InterpolationMode::kLinear, int32_t max_attempts = 10)

Constructor.

Parameters
  • size[in] A vector representing the output size of the cropped image. If the size is a single value, a squared crop of size (size, size) is returned. If the size has 2 values, it should be (height, width).

  • scale[in] Range [min, max) of respective size of the original size to be cropped (default=(0.08, 1.0)).

  • ratio[in] Range [min, max) of aspect ratio to be cropped (default=(3. / 4., 4. / 3.)).

  • interpolation[in] An enum for the mode of interpolation.

    • InterpolationMode::kLinear, Interpolation method is linear interpolation.

    • InterpolationMode::kNearestNeighbour, Interpolation method is nearest-neighbor interpolation.

    • InterpolationMode::kCubic, Interpolation method is bicubic interpolation.

    • InterpolationMode::kArea, Interpolation method is pixel area interpolation.

    • InterpolationMode::kCubicPil, Interpolation method is bicubic interpolation like implemented in pillow.

  • max_attempts[in] The maximum number of attempts to propose a valid crop_area (default=10). If exceeded, fall back to use center_crop instead.

~RandomCropDecodeResize() = default

Destructor.