Class SoftDvppDecodeRandomCropResizeJpeg

Inheritance Relationships

Base Type

Class Documentation

class SoftDvppDecodeRandomCropResizeJpeg : public mindspore::dataset::TensorTransform

Decode, randomly crop and resize a JPEG image using the simulation algorithm of Ascend series chip DVPP module. The application scenario is consistent with SoftDvppDecodeResizeJpeg. The input image size should be in range [32*32, 8192*8192]. The zoom-out and zoom-in multiples of the image length and width should be in the range [1/32, 16]. Only images with an even resolution can be output. The output of odd resolution is not supported.

Public Functions

explicit SoftDvppDecodeRandomCropResizeJpeg(const std::vector<int32_t> &size, const std::vector<float> &scale = {0.08, 1.0}, const std::vector<float> &ratio = {3. / 4., 4. / 3.}, int32_t max_attempts = 10)

Constructor.

Parameters
  • size[in] A vector representing the output size of the resized image. If the size is a single value, smaller edge of 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).

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

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

Example
/* Define operations */
auto dvpp_op = vision::SoftDvppDecodeRandomCropResizeJpeg({255, 255}, {0.1, 1.0});

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

Destructor.