Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
聚火科技码农
PaddleOCR
提交
d1affce6
P
PaddleOCR
项目概览
聚火科技码农
/
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,发现更多精彩内容 >>
提交
d1affce6
编写于
11月 12, 2020
作者:
W
WenmuZhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
delete fluid
上级
453c6f68
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
5 addition
and
6 deletion
+5
-6
ppocr/modeling/heads/rec_ctc_head.py
ppocr/modeling/heads/rec_ctc_head.py
+2
-1
ppocr/optimizer/regularizer.py
ppocr/optimizer/regularizer.py
+3
-5
未找到文件。
ppocr/modeling/heads/rec_ctc_head.py
浏览文件 @
d1affce6
...
@@ -24,7 +24,7 @@ from paddle.nn import functional as F
...
@@ -24,7 +24,7 @@ from paddle.nn import functional as F
def
get_para_bias_attr
(
l2_decay
,
k
,
name
):
def
get_para_bias_attr
(
l2_decay
,
k
,
name
):
regularizer
=
paddle
.
fluid
.
regularizer
.
L2Decay
(
l2_decay
)
regularizer
=
paddle
.
regularizer
.
L2Decay
(
l2_decay
)
stdv
=
1.0
/
math
.
sqrt
(
k
*
1.0
)
stdv
=
1.0
/
math
.
sqrt
(
k
*
1.0
)
initializer
=
nn
.
initializer
.
Uniform
(
-
stdv
,
stdv
)
initializer
=
nn
.
initializer
.
Uniform
(
-
stdv
,
stdv
)
weight_attr
=
ParamAttr
(
weight_attr
=
ParamAttr
(
...
@@ -33,6 +33,7 @@ def get_para_bias_attr(l2_decay, k, name):
...
@@ -33,6 +33,7 @@ def get_para_bias_attr(l2_decay, k, name):
regularizer
=
regularizer
,
initializer
=
initializer
,
name
=
name
+
"_b_attr"
)
regularizer
=
regularizer
,
initializer
=
initializer
,
name
=
name
+
"_b_attr"
)
return
[
weight_attr
,
bias_attr
]
return
[
weight_attr
,
bias_attr
]
class
CTCHead
(
nn
.
Layer
):
class
CTCHead
(
nn
.
Layer
):
def
__init__
(
self
,
in_channels
,
out_channels
,
fc_decay
=
0.0004
,
**
kwargs
):
def
__init__
(
self
,
in_channels
,
out_channels
,
fc_decay
=
0.0004
,
**
kwargs
):
super
(
CTCHead
,
self
).
__init__
()
super
(
CTCHead
,
self
).
__init__
()
...
...
ppocr/optimizer/regularizer.py
浏览文件 @
d1affce6
...
@@ -17,7 +17,7 @@ from __future__ import division
...
@@ -17,7 +17,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
paddle
import
fluid
import
paddle
class
L1Decay
(
object
):
class
L1Decay
(
object
):
...
@@ -32,8 +32,7 @@ class L1Decay(object):
...
@@ -32,8 +32,7 @@ class L1Decay(object):
self
.
regularization_coeff
=
factor
self
.
regularization_coeff
=
factor
def
__call__
(
self
):
def
__call__
(
self
):
reg
=
fluid
.
regularizer
.
L1Decay
(
reg
=
paddle
.
regularizer
.
L1Decay
(
self
.
regularization_coeff
)
regularization_coeff
=
self
.
regularization_coeff
)
return
reg
return
reg
...
@@ -49,6 +48,5 @@ class L2Decay(object):
...
@@ -49,6 +48,5 @@ class L2Decay(object):
self
.
regularization_coeff
=
factor
self
.
regularization_coeff
=
factor
def
__call__
(
self
):
def
__call__
(
self
):
reg
=
fluid
.
regularizer
.
L2Decay
(
reg
=
paddle
.
regularizer
.
L2Decay
(
self
.
regularization_coeff
)
regularization_coeff
=
self
.
regularization_coeff
)
return
reg
return
reg
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录