- class composer.algorithms.ColOut(p_row=0.15, p_col=0.15, batch=True, resize_target='auto', input_key=0, target_key=1)#
Drops a fraction of the rows and columns of an input image and (optionally) a target image. If the fraction of rows/columns dropped isn’t too large, this does not significantly alter the content of the image, but reduces its size and provides extra variability.
batchis True (the default), then this algorithm runs on
Event.AFTER_DATALOADERto modify the batch.
batch=False(the default), this algorithm runs on
Event.INITto insert a dataset transformation. It is a no-op if this algorithm already applied itself on the
See the Method Card for more details.
from composer.algorithms import ColOut from composer.trainer import Trainer colout_algorithm = ColOut(p_row=0.15, p_col=0.15, batch=True) trainer = Trainer( model=model, train_dataloader=train_dataloader, eval_dataloader=eval_dataloader, max_duration="1ep", algorithms=[colout_algorithm], optimizers=[optimizer] )
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:
batch (bool, optional) – Run ColOut at the batch level. Default:
resize_target (bool | str, optional) – Whether to resize the target in addition to the input. If set to
'auto', resizing the target will be based on if the target has the same spatial dimensions as the input. Default:
input_key (str | int | Tuple[Callable, Callable] | Any, optional) – A key that indexes to the input from the batch. Can also be a pair of get and set functions, where the getter is assumed to be first in the pair. The default is 0, which corresponds to any sequence, where the first element is the input. Default:
target_key (str | int | Tuple[Callable, Callable] | Any, optional) – A key that indexes to the target from the batch. Can also be a pair of get and set functions, where the getter is assumed to be first in the pair. The default is 1, which corresponds to any sequence, where the second element is the target. Default: