Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
GoAI
PaddleOCR
提交
695c4db7
P
PaddleOCR
项目概览
GoAI
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
695c4db7
编写于
11月 05, 2020
作者:
W
WenmuZhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
switch learning_rate and lr
上级
d092a5a2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
21 deletion
+23
-21
ppocr/optimizer/learning_rate.py
ppocr/optimizer/learning_rate.py
+23
-21
未找到文件。
ppocr/optimizer/learning_rate.py
浏览文件 @
695c4db7
...
...
@@ -17,7 +17,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
unicode_literals
from
paddle.optimizer
import
lr
as
lr_scheduler
from
paddle.optimizer
import
lr
class
Linear
(
object
):
...
...
@@ -32,7 +32,7 @@ class Linear(object):
"""
def
__init__
(
self
,
l
r
,
l
earning_rate
,
epochs
,
step_each_epoch
,
end_lr
=
0.0
,
...
...
@@ -41,7 +41,7 @@ class Linear(object):
last_epoch
=-
1
,
**
kwargs
):
super
(
Linear
,
self
).
__init__
()
self
.
l
r
=
lr
self
.
l
earning_rate
=
learning_rate
self
.
epochs
=
epochs
*
step_each_epoch
self
.
end_lr
=
end_lr
self
.
power
=
power
...
...
@@ -49,18 +49,18 @@ class Linear(object):
self
.
warmup_epoch
=
warmup_epoch
*
step_each_epoch
def
__call__
(
self
):
learning_rate
=
lr
_scheduler
.
PolynomialLR
(
learning_rate
=
self
.
l
r
,
learning_rate
=
lr
.
PolynomialDecay
(
learning_rate
=
self
.
l
earning_rate
,
decay_steps
=
self
.
epochs
,
end_lr
=
self
.
end_lr
,
power
=
self
.
power
,
last_epoch
=
self
.
last_epoch
)
if
self
.
warmup_epoch
>
0
:
learning_rate
=
lr
_scheduler
.
LinearL
rWarmup
(
learning_rate
=
lr
.
Linea
rWarmup
(
learning_rate
=
learning_rate
,
warmup_steps
=
self
.
warmup_epoch
,
start_lr
=
0.0
,
end_lr
=
self
.
l
r
,
end_lr
=
self
.
l
earning_rate
,
last_epoch
=
self
.
last_epoch
)
return
learning_rate
...
...
@@ -77,27 +77,29 @@ class Cosine(object):
"""
def
__init__
(
self
,
l
r
,
l
earning_rate
,
step_each_epoch
,
epochs
,
warmup_epoch
=
0
,
last_epoch
=-
1
,
**
kwargs
):
super
(
Cosine
,
self
).
__init__
()
self
.
l
r
=
lr
self
.
l
earning_rate
=
learning_rate
self
.
T_max
=
step_each_epoch
*
epochs
self
.
last_epoch
=
last_epoch
self
.
warmup_epoch
=
warmup_epoch
*
step_each_epoch
def
__call__
(
self
):
learning_rate
=
lr_scheduler
.
CosineAnnealingLR
(
learning_rate
=
self
.
lr
,
T_max
=
self
.
T_max
,
last_epoch
=
self
.
last_epoch
)
learning_rate
=
lr
.
CosineAnnealingDecay
(
learning_rate
=
self
.
learning_rate
,
T_max
=
self
.
T_max
,
last_epoch
=
self
.
last_epoch
)
if
self
.
warmup_epoch
>
0
:
learning_rate
=
lr
_scheduler
.
LinearL
rWarmup
(
learning_rate
=
lr
.
Linea
rWarmup
(
learning_rate
=
learning_rate
,
warmup_steps
=
self
.
warmup_epoch
,
start_lr
=
0.0
,
end_lr
=
self
.
l
r
,
end_lr
=
self
.
l
earning_rate
,
last_epoch
=
self
.
last_epoch
)
return
learning_rate
...
...
@@ -115,7 +117,7 @@ class Step(object):
"""
def
__init__
(
self
,
l
r
,
l
earning_rate
,
step_size
,
step_each_epoch
,
gamma
,
...
...
@@ -124,23 +126,23 @@ class Step(object):
**
kwargs
):
super
(
Step
,
self
).
__init__
()
self
.
step_size
=
step_each_epoch
*
step_size
self
.
l
r
=
lr
self
.
l
earning_rate
=
learning_rate
self
.
gamma
=
gamma
self
.
last_epoch
=
last_epoch
self
.
warmup_epoch
=
warmup_epoch
*
step_each_epoch
def
__call__
(
self
):
learning_rate
=
lr
_scheduler
.
StepLR
(
learning_rate
=
self
.
l
r
,
learning_rate
=
lr
.
StepDecay
(
learning_rate
=
self
.
l
earning_rate
,
step_size
=
self
.
step_size
,
gamma
=
self
.
gamma
,
last_epoch
=
self
.
last_epoch
)
if
self
.
warmup_epoch
>
0
:
learning_rate
=
lr
_scheduler
.
LinearL
rWarmup
(
learning_rate
=
lr
.
Linea
rWarmup
(
learning_rate
=
learning_rate
,
warmup_steps
=
self
.
warmup_epoch
,
start_lr
=
0.0
,
end_lr
=
self
.
l
r
,
end_lr
=
self
.
l
earning_rate
,
last_epoch
=
self
.
last_epoch
)
return
learning_rate
...
...
@@ -169,12 +171,12 @@ class Piecewise(object):
self
.
warmup_epoch
=
warmup_epoch
*
step_each_epoch
def
__call__
(
self
):
learning_rate
=
lr
_scheduler
.
PiecewiseLR
(
learning_rate
=
lr
.
PiecewiseDecay
(
boundaries
=
self
.
boundaries
,
values
=
self
.
values
,
last_epoch
=
self
.
last_epoch
)
if
self
.
warmup_epoch
>
0
:
learning_rate
=
lr
_scheduler
.
LinearL
rWarmup
(
learning_rate
=
lr
.
Linea
rWarmup
(
learning_rate
=
learning_rate
,
warmup_steps
=
self
.
warmup_epoch
,
start_lr
=
0.0
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录