ProgressiveResizing (original) (raw)

Back to top

Edit this page

Toggle table of contents sidebar

class composer.algorithms.ProgressiveResizing(mode='resize', initial_scale=0.5, finetune_fraction=0.2, delay_fraction=0.5, size_increment=4, resize_targets=False, input_key=0, target_key=1)[source]#

Resize inputs and optionally outputs by cropping or interpolating.

Apply Fastai’s [progressive resizing](https:// github.com/fastai/fastbook/blob/780b76bef3127ce5b64f8230fce60e915a7e0735/07%5Fsizing%5Fand%5Ftta.ipynb) data augmentation to speed up training.

Progressive resizing initially reduces input resolution to speed up early training. Throughout training, the downsampling factor is gradually increased, yielding larger inputs up to the original input size. A final finetuning period is then run to finetune the model using the full-sized inputs.

Example

from composer.algorithms import ProgressiveResizing from composer.trainer import Trainer progressive_resizing_algorithm = ProgressiveResizing( mode='resize', initial_scale=1.0, finetune_fraction=0.2, delay_fraction=0.2, size_increment=32, resize_targets=False ) trainer = Trainer( model=model, train_dataloader=train_dataloader, eval_dataloader=eval_dataloader, max_duration="1ep", algorithms=[progressive_resizing_algorithm], optimizers=[optimizer] )

Parameters