mindcv.scheduler¶
Learning Rate Scheduler
- mindcv.scheduler.create_scheduler(steps_per_epoch, scheduler='constant', lr=0.01, min_lr=1e-06, warmup_epochs=3, warmup_factor=0.0, decay_epochs=10, decay_rate=0.9, milestones=None, num_epochs=200, num_cycles=1, cycle_decay=1.0, lr_epoch_stair=False)[源代码]¶
Creates learning rate scheduler by name.
- 参数
steps_per_epoch (int) – number of steps per epoch.
scheduler (str) – scheduler name like ‘constant’, ‘cosine_decay’, ‘step_decay’, ‘exponential_decay’, ‘polynomial_decay’, ‘multi_step_decay’. Default: ‘constant’.
lr (float) – learning rate value. Default: 0.01.
min_lr (float) – lower lr bound for ‘cosine_decay’ schedulers. Default: 1e-6.
warmup_epochs (int) – epochs to warmup LR, if scheduler supports. Default: 3.
warmup_factor (float) – the warmup phase of scheduler is a linearly increasing lr, the beginning factor is warmup_factor, i.e., the lr of the first step/epoch is lr*warmup_factor, and the ending lr in the warmup phase is lr. Default: 0.0
decay_epochs (int) – for ‘cosine_decay’ schedulers, decay LR to min_lr in decay_epochs. For ‘step_decay’ scheduler, decay LR by a factor of decay_rate every decay_epochs. Default: 10.
decay_rate (float) – LR decay rate (default: 0.9)
milestones (Optional[list]) – list of epoch milestones for ‘multi_step_decay’ scheduler. Must be increasing.
num_epochs (int) – number of total epochs.
lr_epoch_stair (bool) – If True, LR will be updated in the beginning of each new epoch and the LR will be consistent for each batch in one epoch. Otherwise, learning rate will be updated dynamically in each step. (default=False)
num_cycles (int) –
cycle_decay (float) –
- 返回
Cell object for computing LR with input of current global steps