- composer.functional.colout_batch(sample, p_row=0.15, p_col=0.15, resize_target='auto')#
Applies ColOut augmentation to a batch of images and (optionally) targets, dropping the same random rows and columns from all images and targets in a batch.
See the Method Card for more details.
from composer.algorithms.colout import colout_batch new_X = colout_batch(X_example, p_row=0.15, p_col=0.15)
sample (Tensor | PIL.Image | Tuple[Tensor, Tensor] | Tuple[PIL.Image, PIL.Image]) – Either a single tensor or image or a 2-tuple of tensors or images. When tensor(s), the tensor must be of shape
CHWfor a single image or
NCHWfor a batch of images of shape.
p_row (float, optional) – Fraction of rows to drop (drop along H). Default:
p_col (float, optional) – Fraction of columns to drop (drop along W). Default:
resize_target (bool | str, optional) – If
sampleis a tuple, whether to resize both objects in the tuple. If set to
'auto', both objects will be resized if they have the same spatial dimensions. Otherwise, only the first object is resized. Default:
torch.Tensor | PIL.Image | Tuple[torch.Tensor, torch.Tensor] | Tuple[PIL.Image, PIL.Image] – A smaller image or 2-tuple of images with random rows and columns dropped.