diff --git a/ppcls/configs/reid/strong_baseline/softmax_triplet_with_center.yaml b/ppcls/configs/reid/strong_baseline/softmax_triplet_with_center.yaml index b500fb20390a1bbf9cb3f9cc5b7492fa5dacd7a5..70c70a99bc7f7d5317b5d004a7b97123f19e4fad 100644 --- a/ppcls/configs/reid/strong_baseline/softmax_triplet_with_center.yaml +++ b/ppcls/configs/reid/strong_baseline/softmax_triplet_with_center.yaml @@ -87,7 +87,7 @@ Optimizer: - SGD: scope: CenterLoss lr: - name: Constant + name: ConstLR learning_rate: 1000.0 # NOTE: set to ori_lr*(1/centerloss_weight) to avoid manually scaling centers' gradidents. # data loader for train and eval diff --git a/ppcls/optimizer/learning_rate.py b/ppcls/optimizer/learning_rate.py index 75a0c07ed935c0dcc3be0eebe005d3c1da95e099..c8d87517ecd7b4c4d98a84ae13ea1331c5e1fe6a 100644 --- a/ppcls/optimizer/learning_rate.py +++ b/ppcls/optimizer/learning_rate.py @@ -93,7 +93,7 @@ class LRBase(object): return warmup_lr -class ConstantImpl(lr.LRScheduler): +class Constant(lr.LRScheduler): """Constant learning rate Class implementation Args: @@ -104,7 +104,7 @@ class ConstantImpl(lr.LRScheduler): def __init__(self, learning_rate, last_epoch=-1, **kwargs): self.learning_rate = learning_rate self.last_epoch = last_epoch - super(ConstantImpl, self).__init__() + super(Constant, self).__init__() def get_lr(self) -> float: """always return the same learning rate @@ -112,7 +112,7 @@ class ConstantImpl(lr.LRScheduler): return self.learning_rate -class Constant(LRBase): +class ConstLR(LRBase): """Constant learning rate Args: @@ -134,12 +134,12 @@ class Constant(LRBase): last_epoch=-1, by_epoch=False, **kwargs): - super(Constant, self).__init__(epochs, step_each_epoch, learning_rate, - warmup_epoch, warmup_start_lr, - last_epoch, by_epoch) + super(ConstLR, self).__init__(epochs, step_each_epoch, learning_rate, + warmup_epoch, warmup_start_lr, + last_epoch, by_epoch) def __call__(self): - learning_rate = ConstantImpl( + learning_rate = Constant( learning_rate=self.learning_rate, last_epoch=self.last_epoch) if self.warmup_steps > 0: