Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
a5280c0f
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
1 年多 前同步成功
通知
1532
Star
32963
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a5280c0f
编写于
12月 17, 2021
作者:
T
tink2123
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
polist seed code
上级
13961868
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
8 deletion
+15
-8
configs/rec/rec_resnet_stn_bilstm_att.yml
configs/rec/rec_resnet_stn_bilstm_att.yml
+2
-2
ppocr/data/imaug/label_ops.py
ppocr/data/imaug/label_ops.py
+7
-3
ppocr/modeling/heads/rec_aster_head.py
ppocr/modeling/heads/rec_aster_head.py
+1
-1
ppocr/postprocess/rec_postprocess.py
ppocr/postprocess/rec_postprocess.py
+5
-2
未找到文件。
configs/rec/rec_resnet_stn_bilstm_att.yml
浏览文件 @
a5280c0f
...
...
@@ -75,7 +75,7 @@ Train:
channel_first
:
False
-
SEEDLabelEncode
:
# Class handling label
-
RecResizeImg
:
character_
type
:
en
character_
dict_path
:
image_shape
:
[
3
,
64
,
256
]
padding
:
False
-
KeepKeys
:
...
...
@@ -96,7 +96,7 @@ Eval:
channel_first
:
False
-
SEEDLabelEncode
:
# Class handling label
-
RecResizeImg
:
character_
type
:
en
character_
dict_path
:
image_shape
:
[
3
,
64
,
256
]
padding
:
False
-
KeepKeys
:
...
...
ppocr/data/imaug/label_ops.py
浏览文件 @
a5280c0f
...
...
@@ -344,8 +344,12 @@ class SEEDLabelEncode(BaseRecLabelEncode):
max_text_length
,
character_dict_path
,
use_space_char
)
def
add_special_char
(
self
,
dict_character
):
self
.
padding
=
"padding"
self
.
end_str
=
"eos"
dict_character
=
dict_character
+
[
self
.
end_str
]
self
.
unknown
=
"unknown"
dict_character
=
dict_character
+
[
self
.
end_str
,
self
.
padding
,
self
.
unknown
]
return
dict_character
def
__call__
(
self
,
data
):
...
...
@@ -356,8 +360,8 @@ class SEEDLabelEncode(BaseRecLabelEncode):
if
len
(
text
)
>=
self
.
max_text_len
:
return
None
data
[
'length'
]
=
np
.
array
(
len
(
text
))
+
1
# conclude eos
text
=
text
+
[
len
(
self
.
character
)
-
1
]
*
(
self
.
max_text_len
-
len
(
text
)
)
text
=
text
+
[
len
(
self
.
character
)
-
3
]
+
[
len
(
self
.
character
)
-
2
]
*
(
self
.
max_text_len
-
len
(
text
)
-
1
)
data
[
'label'
]
=
np
.
array
(
text
)
return
data
...
...
ppocr/modeling/heads/rec_aster_head.py
浏览文件 @
a5280c0f
...
...
@@ -47,7 +47,7 @@ class AsterHead(nn.Layer):
self
.
time_step
=
time_step
self
.
embeder
=
Embedding
(
self
.
time_step
,
in_channels
)
self
.
beam_width
=
beam_width
self
.
eos
=
self
.
num_classes
-
1
self
.
eos
=
self
.
num_classes
-
3
def
forward
(
self
,
x
,
targets
=
None
,
embed
=
None
):
return_dict
=
{}
...
...
ppocr/postprocess/rec_postprocess.py
浏览文件 @
a5280c0f
...
...
@@ -287,9 +287,12 @@ class SEEDLabelDecode(BaseRecLabelDecode):
use_space_char
)
def
add_special_char
(
self
,
dict_character
):
self
.
beg_str
=
"sos
"
self
.
padding_str
=
"padding
"
self
.
end_str
=
"eos"
dict_character
=
dict_character
+
[
self
.
end_str
]
self
.
unknown
=
"unknown"
dict_character
=
dict_character
+
[
self
.
end_str
,
self
.
padding_str
,
self
.
unknown
]
return
dict_character
def
get_ignored_tokens
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录