Skip to content

Commit

Permalink
[fbsync] Clarify docstring of RandomResizedCrop (#3584)
Browse files Browse the repository at this point in the history
Reviewed By: fmassa

Differential Revision: D27433914

fbshipit-source-id: 390360a31a5998d9c2e2052dcdef60b5ecb8eb9d
  • Loading branch information
parmeet authored and facebook-github-bot committed Apr 1, 2021
1 parent 2849ae3 commit 09f21eb
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions torchvision/transforms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,22 +773,23 @@ def __repr__(self):


class RandomResizedCrop(torch.nn.Module):
"""Crop the given image to random size and aspect ratio.
"""Crop a random portion of image and resize it to a given size.
If the image is torch Tensor, it is expected
to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions
A crop of random size (default: of 0.08 to 1.0) of the original size and a random
aspect ratio (default: of 3/4 to 4/3) of the original aspect ratio is made. This crop
is finally resized to given size.
This is popularly used to train the Inception networks.
A crop of the original image is made: the crop has a random area (H * W)
and a random aspect ratio. This crop is finally resized to the given
size. This is popularly used to train the Inception networks.
Args:
size (int or sequence): expected output size of each edge. If size is an
size (int or sequence): expected output size of the crop, for each edge. If size is an
int instead of sequence like (h, w), a square output size ``(size, size)`` is
made. If provided a sequence of length 1, it will be interpreted as (size[0], size[0]).
In torchscript mode size as single int is not supported, use a sequence of length 1: ``[size, ]``.
scale (tuple of float): scale range of the cropped image before resizing, relatively to the origin image.
ratio (tuple of float): aspect ratio range of the cropped image before resizing.
scale (tuple of float): lower and upper bounds for the random area of the crop, before resizing.
ratio (tuple of float): lower and upper bounds for the random aspect ratio of the crop, before
resizing.
interpolation (InterpolationMode): Desired interpolation enum defined by
:class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``.
If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` and
Expand Down

0 comments on commit 09f21eb

Please sign in to comment.