Class Resize

Inheritance Relationships

Base Type

Class Documentation

class Resize : public mindspore::dataset::TensorTransform

Resize the input image to the given size.

Public Functions

explicit Resize(const std::vector<int32_t> &size, InterpolationMode interpolation = InterpolationMode::kLinear)

Constructor.

Example
/* Define operations */
auto decode_op = vision::Decode();
auto resize_op = vision::Resize({224, 224}, InterpolationMode::kLinear);

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

参数
  • size[in] A vector representing the output size of the resized image. If the size is a single value, the image will be resized to this value with the same image aspect ratio. If the size has 2 values, it should be (height, width).

  • 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.

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

~Resize() = default

Destructor.