Class RandomResizedCropWithBBox

Inheritance Relationships

Base Type

Class Documentation

class RandomResizedCropWithBBox : public mindspore::dataset::TensorTransform

Crop the input image to a random size and aspect ratio. If cropped area is out of bbox, the return bbox will be empty.

Public Functions

RandomResizedCropWithBBox(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] Image interpolation mode (default=InterpolationMode::kLinear).

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

~RandomResizedCropWithBBox() = default

Destructor.