CenterCrop¶
- class torchaug.transforms.CenterCrop(size)[source]¶
Crop the input at the center.
If the input is a
torch.Tensoror aTATensor(e.g.Image,Video,BoundingBoxesetc.) it can have arbitrary number of leading batch dimensions. For example, the image can have[..., C, H, W]shape. A bounding box can have[..., 4]shape.If image size is smaller than output size along any edge, image is padded with 0 and then center cropped.
- Parameters:
size (
Union[int,Sequence[int]]) – Desired output size of the crop. If size is an int instead of sequence like (h, w), a square crop (size, size) is made. If provided a sequence of length 1, it will be interpreted as (size[0], size[0]).batch_transform – whether to apply the transform in batch mode.