View source: R/transforms-generics.R
| transform_random_crop | R Documentation |
The image can be a Magick Image or a Tensor, in which case it is expected
to have [..., H, W] shape, where ... means an arbitrary number of leading
dimensions.
transform_random_crop(
img,
size,
padding = NULL,
pad_if_needed = FALSE,
fill = 0,
padding_mode = "constant"
)
img |
A |
size |
(integer vector or integer): Desired output size. If |
padding |
(integer vector or integer): Padding on each border. If a single integer is provided, this value is used to pad all borders. If an integer vector of length 2 is provided, it gives the padding on left/right and top/bottom respectively. If an integer vector of length 4 is provided, it gives the padding for the left, right, top and bottom borders respectively. |
pad_if_needed |
(logical): It will pad the image if smaller than the desired size to avoid raising an exception. Since cropping is done after padding, the padding seems to be done at a random offset. |
fill |
(numeric vector or numeric): Pixel fill value for constant fill.
Default is |
padding_mode |
(character): Type of padding. Should be:
|
Other random_transforms:
transform_color_jitter(),
transform_random_affine(),
transform_random_erasing(),
transform_random_grayscale(),
transform_random_horizontal_flip(),
transform_random_perspective(),
transform_random_resized_crop(),
transform_random_rotation(),
transform_random_vertical_flip()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.