Class RandomResizedCrop
- Defined in File vision.h 
Inheritance Relationships
Base Type
- public mindspore::dataset::TensorTransform(Class TensorTransform)
Class Documentation
- 
class RandomResizedCrop : public mindspore::dataset::TensorTransform
- Crop the input image to a random size and aspect ratio. - Public Functions - 
explicit RandomResizedCrop(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. - 说明 - If the input image is more than one, then make sure that the image size is the same. - 参数
- 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] Image interpolation mode (default=InterpolationMode::kLinear). - 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 decode_op = vision::Decode(); auto random_op = vision::RandomResizedCrop({32, 32}, {0.08, 1.0}); /* dataset is an instance of Dataset object */ dataset = dataset->Map({decode_op, random_op}, // operations {"image"}); // input columns 
 
 - 
~RandomResizedCrop() override = default
- Destructor. 
 
- 
explicit RandomResizedCrop(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)