From a96766c822dba5162b6288a9a71f8c33b8957478 Mon Sep 17 00:00:00 2001 From: qujianwei Date: Thu, 15 Oct 2020 15:15:15 +0800 Subject: [PATCH] fix for se-resnet50 accurancy --- model_zoo/official/cv/resnet/src/lr_generator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/model_zoo/official/cv/resnet/src/lr_generator.py b/model_zoo/official/cv/resnet/src/lr_generator.py index ed9e81abd2e..7b6c70e943c 100755 --- a/model_zoo/official/cv/resnet/src/lr_generator.py +++ b/model_zoo/official/cv/resnet/src/lr_generator.py @@ -100,8 +100,10 @@ def _generate_cosine_lr(lr_init, lr_end, lr_max, total_steps, warmup_steps): lr_inc = (float(lr_max) - float(lr_init)) / float(warmup_steps) lr = float(lr_init) + lr_inc * (i + 1) else: - cosine_decay = 0.5 * (1 + math.cos(math.pi * (i-warmup_steps) / decay_steps)) - lr = (lr_max-lr_end)*cosine_decay + lr_end + linear_decay = (total_steps - i) / decay_steps + cosine_decay = 0.5 * (1 + math.cos(math.pi * 2 * 0.47 * i / decay_steps)) + decayed = linear_decay * cosine_decay + 0.00001 + lr = lr_max * decayed lr_each_step.append(lr) return lr_each_step