Python mxnet.lr_scheduler.LRScheduler() Examples
The following are 8
code examples of mxnet.lr_scheduler.LRScheduler().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
mxnet.lr_scheduler
, or try the search function
.
Example #1
Source File: lr_scheduler.py From cascade_rcnn_gluon with Apache License 2.0 | 6 votes |
def __init__(self, mode, baselr, niters, nepochs, step=(30, 60, 90), step_factor=0.1, targetlr=0, power=0.9, warmup_epochs=0, warmup_lr=0, warmup_mode='linear'): super(LRScheduler, self).__init__() assert(mode in ['step', 'poly', 'cosine']) assert(warmup_mode in ['linear', 'constant']) self.mode = mode self.baselr = baselr self.learning_rate = self.baselr self.niters = niters self.step = step self.step_factor = step_factor self.targetlr = targetlr self.power = power self.warmup_epochs = warmup_epochs self.warmup_lr = warmup_lr self.warmup_mode = warmup_mode self.N = nepochs * niters self.warmup_N = warmup_epochs * niters
Example #2
Source File: lr_scheduler.py From gluon-cv with Apache License 2.0 | 5 votes |
def add(self, scheduler): assert(isinstance(scheduler, LRScheduler)) scheduler.offset = self.count self.count += scheduler.niters self.update_sep.append(self.count) self.schedulers.append(scheduler)
Example #3
Source File: lr_scheduler.py From gluon-cv with Apache License 2.0 | 5 votes |
def __init__(self, mode, base_lr=0.1, target_lr=0, niters=0, nepochs=0, iters_per_epoch=0, offset=0, power=2, step_iter=None, step_epoch=None, step_factor=0.1, baselr=None, targetlr=None): super(LRScheduler, self).__init__() assert(mode in ['constant', 'step', 'linear', 'poly', 'cosine']) self.mode = mode if mode == 'step': assert(step_iter is not None or step_epoch is not None) if baselr is not None: warnings.warn("baselr is deprecated. Please use base_lr.") if base_lr == 0.1: base_lr = baselr self.base_lr = base_lr if targetlr is not None: warnings.warn("targetlr is deprecated. Please use target_lr.") if target_lr == 0: target_lr = targetlr self.target_lr = target_lr if self.mode == 'constant': self.target_lr = self.base_lr self.niters = niters self.step = step_iter epoch_iters = nepochs * iters_per_epoch if epoch_iters > 0: self.niters = epoch_iters if step_epoch is not None: self.step = [s*iters_per_epoch for s in step_epoch] self.offset = offset self.power = power self.step_factor = step_factor
Example #4
Source File: lr_scheduler.py From imgclsmob with MIT License | 5 votes |
def __init__(self, mode, base_lr, n_iters, n_epochs, step=(30, 60, 90), step_factor=0.1, target_lr=0, power=0.9, warmup_epochs=0, warmup_lr=0, warmup_mode="linear"): super(LRScheduler, self).__init__(base_lr=base_lr) assert(mode in ["step", "poly", "cosine"]) assert(warmup_mode in ["constant", "linear", "poly", "cosine"]) self.mode = mode self.learning_rate = self.base_lr self.n_iters = n_iters self.step = step self.step_factor = step_factor self.target_lr = target_lr self.power = power self.warmup_epochs = warmup_epochs self.warmup_lr = warmup_lr self.warmup_mode = warmup_mode self.N = n_epochs * n_iters self.warmup_N = warmup_epochs * n_iters
Example #5
Source File: lr_scheduler.py From simpledet with Apache License 2.0 | 5 votes |
def add(self, scheduler): assert(isinstance(scheduler, LRScheduler)) scheduler.offset = self.count self.count += scheduler.niters self.update_sep.append(self.count) self.schedulers.append(scheduler)
Example #6
Source File: lr_scheduler.py From panoptic-fpn-gluon with Apache License 2.0 | 5 votes |
def add(self, scheduler): assert(isinstance(scheduler, LRScheduler)) scheduler.offset = self.count self.count += scheduler.niters self.update_sep.append(self.count) self.schedulers.append(scheduler)
Example #7
Source File: lr_scheduler.py From panoptic-fpn-gluon with Apache License 2.0 | 5 votes |
def __init__(self, mode, base_lr=0.1, target_lr=0, niters=0, nepochs=0, iters_per_epoch=0, offset=0, power=2, step_iter=None, step_epoch=None, step_factor=0.1, baselr=None, targetlr=None): super(LRScheduler, self).__init__() assert(mode in ['constant', 'step', 'linear', 'poly', 'cosine']) self.mode = mode if mode == 'step': assert(step_iter is not None or step_epoch is not None) if baselr is not None: warnings.warn("baselr is deprecated. Please use base_lr.") if base_lr == 0.1: base_lr = baselr self.base_lr = base_lr if targetlr is not None: warnings.warn("targetlr is deprecated. Please use target_lr.") if target_lr == 0: target_lr = targetlr self.target_lr = target_lr if self.mode == 'constant': self.target_lr = self.base_lr self.niters = niters self.step = step_iter epoch_iters = nepochs * iters_per_epoch if epoch_iters > 0: self.niters = epoch_iters if step_epoch is not None: self.step = [s*iters_per_epoch for s in step_epoch] self.offset = offset self.power = power self.step_factor = step_factor
Example #8
Source File: lr_scheduler.py From groupsoftmax-simpledet with Apache License 2.0 | 5 votes |
def add(self, scheduler): assert(isinstance(scheduler, LRScheduler)) scheduler.offset = self.count self.count += scheduler.niters self.update_sep.append(self.count) self.schedulers.append(scheduler)