Class RandomCropDecodeResize
Defined in File vision.h
Inheritance Relationships
Base Type
public mindspore::dataset::TensorTransform
(Class TensorTransform)
Class Documentation
-
class RandomCropDecodeResize : public mindspore::dataset::TensorTransform
Equivalent to RandomResizedCrop TensorTransform, but crop the image before decoding.
Public Functions
-
explicit RandomCropDecodeResize(const std::vector<int32_t> &size, const std::vector<float> &scale = {0.08, 1.0}, const 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 blinear 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.
样例/* Define operations */ auto random_op = vision::RandomCropDecodeResize({255, 255}, {0.1, 0.5}); /* dataset is an instance of Dataset object */ dataset = dataset->Map({random_op}, // operations {"image"}); // input columns
-
~RandomCropDecodeResize() = default
Destructor.
-
explicit RandomCropDecodeResize(const std::vector<int32_t> &size, const std::vector<float> &scale = {0.08, 1.0}, const std::vector<float> &ratio = {3. / 4, 4. / 3}, InterpolationMode interpolation = InterpolationMode::kLinear, int32_t max_attempts = 10)