提交 b27207ba 编写于 作者: T tink2123

update cosine decay doc

上级 ec35c94b
...@@ -58,6 +58,6 @@ ...@@ -58,6 +58,6 @@
| beta1 | 设置一阶矩估计的指数衰减率 | 0.9 | \ | | beta1 | 设置一阶矩估计的指数衰减率 | 0.9 | \ |
| beta2 | 设置二阶矩估计的指数衰减率 | 0.999 | \ | | beta2 | 设置二阶矩估计的指数衰减率 | 0.999 | \ |
| decay | 是否使用decay | \ | \ | | decay | 是否使用decay | \ | \ |
| function(decay) | 设置decay方式 | cosine_decay | \ | | function(decay) | 设置decay方式 | cosine_decay | 目前只支持cosin_decay |
| step_each_epoch | 每个epoch包含多少次迭代 | 20 | 计算方式:total_image_num / (batch_size_per_card * card_size) | | step_each_epoch | 每个epoch包含多少次迭代 | 20 | 计算方式:total_image_num / (batch_size_per_card * card_size) |
| total_epoch | 总共迭代多少个epoch | 1000 | 与Global.epoch_num 一致 | | total_epoch | 总共迭代多少个epoch | 1000 | 与Global.epoch_num 一致 |
...@@ -58,6 +58,6 @@ Take `rec_icdar15_train.yml` as an example: ...@@ -58,6 +58,6 @@ Take `rec_icdar15_train.yml` as an example:
| beta1 | Set the exponential decay rate for the 1st moment estimates | 0.9 | \ | | beta1 | Set the exponential decay rate for the 1st moment estimates | 0.9 | \ |
| beta2 | Set the exponential decay rate for the 2nd moment estimates | 0.999 | \ | | beta2 | Set the exponential decay rate for the 2nd moment estimates | 0.999 | \ |
| decay | Whether to use decay | \ | \ | | decay | Whether to use decay | \ | \ |
| function(decay) | Set the decay function | cosine_decay | \ | | function(decay) | Set the decay function | cosine_decay | Only support cosine_decay |
| step_each_epoch | The number of steps in an epoch. | 20 | Calculation :total_image_num / (batch_size_per_card * card_size) | | step_each_epoch | The number of steps in an epoch. | 20 | Calculation :total_image_num / (batch_size_per_card * card_size) |
| total_epoch | The number of epochs | 1000 | Consistent with Global.epoch_num | | total_epoch | The number of epochs | 1000 | Consistent with Global.epoch_num |
...@@ -15,6 +15,9 @@ from __future__ import absolute_import ...@@ -15,6 +15,9 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import paddle.fluid as fluid import paddle.fluid as fluid
from ppocr.utils.utility import initial_logger
logger = initial_logger()
def AdamDecay(params, parameter_list=None): def AdamDecay(params, parameter_list=None):
...@@ -38,6 +41,8 @@ def AdamDecay(params, parameter_list=None): ...@@ -38,6 +41,8 @@ def AdamDecay(params, parameter_list=None):
learning_rate=base_lr, learning_rate=base_lr,
step_each_epoch=step_each_epoch, step_each_epoch=step_each_epoch,
epochs=total_epoch) epochs=total_epoch)
else:
logger.info("Only support Cosine decay currently")
optimizer = fluid.optimizer.Adam( optimizer = fluid.optimizer.Adam(
learning_rate=base_lr, learning_rate=base_lr,
beta1=beta1, beta1=beta1,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册