Table Of Contents
Table Of Contents


mxnet.image.random_size_crop(src, size, area, ratio, interp=2, **kwargs)[source]

Randomly crop src with size. Randomize area and aspect ratio.

  • src (NDArray) – Input image

  • size (tuple of (int, int)) – Size of the crop formatted as (width, height).

  • area (float in (0, 1] or tuple of (float, float)) – If tuple, minimum area and maximum area to be maintained after cropping If float, minimum area to be maintained after cropping, maximum area is set to 1.0

  • ratio (tuple of (float, float)) – Aspect ratio range as (min_aspect_ratio, max_aspect_ratio)

  • interp (int, optional, default=2) – Interpolation method. See resize_short for details.


  • NDArray – An NDArray containing the cropped image.

  • Tuple – A tuple (x, y, width, height) where (x, y) is top-left position of the crop in the original image and (width, height) are the dimensions of the cropped image.