Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
683c86ed
P
PaddleOCR
项目概览
s920243400
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
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看板
未验证
提交
683c86ed
编写于
12月 20, 2021
作者:
M
MissPenguin
提交者:
GitHub
12月 20, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4960 from tink2123/fix_seed_padding
polist seed code
上级
7109fadc
a5280c0f
变更
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
浏览文件 @
683c86ed
...
...
@@ -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
浏览文件 @
683c86ed
...
...
@@ -507,8 +507,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
):
...
...
@@ -519,8 +523,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
浏览文件 @
683c86ed
...
...
@@ -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
浏览文件 @
683c86ed
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录