Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
941869e6
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
接近 2 年 前同步成功
通知
1549
Star
32964
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看板
未验证
提交
941869e6
编写于
8月 31, 2023
作者:
X
xiaoting
提交者:
GitHub
8月 31, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "add encoding for open (#10769)" (#10789)
This reverts commit
c1b943fb
.
上级
c1b943fb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
12 addition
and
12 deletion
+12
-12
ppocr/data/imaug/label_ops.py
ppocr/data/imaug/label_ops.py
+4
-4
ppocr/data/pubtab_dataset.py
ppocr/data/pubtab_dataset.py
+2
-2
ppocr/data/simple_dataset.py
ppocr/data/simple_dataset.py
+4
-4
ppocr/postprocess/rec_postprocess.py
ppocr/postprocess/rec_postprocess.py
+1
-1
ppocr/postprocess/table_postprocess.py
ppocr/postprocess/table_postprocess.py
+1
-1
未找到文件。
ppocr/data/imaug/label_ops.py
浏览文件 @
941869e6
...
@@ -118,7 +118,7 @@ class BaseRecLabelEncode(object):
...
@@ -118,7 +118,7 @@ class BaseRecLabelEncode(object):
self
.
lower
=
True
self
.
lower
=
True
else
:
else
:
self
.
character_str
=
[]
self
.
character_str
=
[]
with
open
(
character_dict_path
,
"rb"
,
encoding
=
"utf-8"
)
as
fin
:
with
open
(
character_dict_path
,
"rb"
)
as
fin
:
lines
=
fin
.
readlines
()
lines
=
fin
.
readlines
()
for
line
in
lines
:
for
line
in
lines
:
line
=
line
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
strip
(
"
\r\n
"
)
line
=
line
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
strip
(
"
\r\n
"
)
...
@@ -278,7 +278,7 @@ class KieLabelEncode(object):
...
@@ -278,7 +278,7 @@ class KieLabelEncode(object):
char
=
line
.
strip
()
char
=
line
.
strip
()
self
.
dict
[
char
]
=
idx
self
.
dict
[
char
]
=
idx
idx
+=
1
idx
+=
1
with
open
(
class_path
,
"r"
,
encoding
=
"utf-8"
)
as
fin
:
with
open
(
class_path
,
"r"
)
as
fin
:
lines
=
fin
.
readlines
()
lines
=
fin
.
readlines
()
for
idx
,
line
in
enumerate
(
lines
):
for
idx
,
line
in
enumerate
(
lines
):
line
=
line
.
strip
(
"
\n
"
)
line
=
line
.
strip
(
"
\n
"
)
...
@@ -640,7 +640,7 @@ class TableLabelEncode(AttnLabelEncode):
...
@@ -640,7 +640,7 @@ class TableLabelEncode(AttnLabelEncode):
self
.
replace_empty_cell_token
=
replace_empty_cell_token
self
.
replace_empty_cell_token
=
replace_empty_cell_token
dict_character
=
[]
dict_character
=
[]
with
open
(
character_dict_path
,
"rb"
,
encoding
=
"utf-8"
)
as
fin
:
with
open
(
character_dict_path
,
"rb"
)
as
fin
:
lines
=
fin
.
readlines
()
lines
=
fin
.
readlines
()
for
line
in
lines
:
for
line
in
lines
:
line
=
line
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
strip
(
"
\r\n
"
)
line
=
line
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
strip
(
"
\r\n
"
)
...
@@ -1380,7 +1380,7 @@ class SRLabelEncode(BaseRecLabelEncode):
...
@@ -1380,7 +1380,7 @@ class SRLabelEncode(BaseRecLabelEncode):
super
(
SRLabelEncode
,
self
).
__init__
(
max_text_length
,
super
(
SRLabelEncode
,
self
).
__init__
(
max_text_length
,
character_dict_path
,
use_space_char
)
character_dict_path
,
use_space_char
)
self
.
dic
=
{}
self
.
dic
=
{}
with
open
(
character_dict_path
,
'r'
,
encoding
=
"utf-8"
)
as
fin
:
with
open
(
character_dict_path
,
'r'
)
as
fin
:
for
line
in
fin
.
readlines
():
for
line
in
fin
.
readlines
():
line
=
line
.
strip
()
line
=
line
.
strip
()
character
,
sequence
=
line
.
split
()
character
,
sequence
=
line
.
split
()
...
...
ppocr/data/pubtab_dataset.py
浏览文件 @
941869e6
...
@@ -59,7 +59,7 @@ class PubTabDataSet(Dataset):
...
@@ -59,7 +59,7 @@ class PubTabDataSet(Dataset):
file_list
=
[
file_list
]
file_list
=
[
file_list
]
data_lines
=
[]
data_lines
=
[]
for
idx
,
file
in
enumerate
(
file_list
):
for
idx
,
file
in
enumerate
(
file_list
):
with
open
(
file
,
"rb"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
file
,
"rb"
)
as
f
:
lines
=
f
.
readlines
()
lines
=
f
.
readlines
()
if
self
.
mode
==
"train"
or
ratio_list
[
idx
]
<
1.0
:
if
self
.
mode
==
"train"
or
ratio_list
[
idx
]
<
1.0
:
random
.
seed
(
self
.
seed
)
random
.
seed
(
self
.
seed
)
...
@@ -112,7 +112,7 @@ class PubTabDataSet(Dataset):
...
@@ -112,7 +112,7 @@ class PubTabDataSet(Dataset):
'file_name'
:
file_name
'file_name'
:
file_name
}
}
with
open
(
data
[
'img_path'
],
'rb'
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
data
[
'img_path'
],
'rb'
)
as
f
:
img
=
f
.
read
()
img
=
f
.
read
()
data
[
'image'
]
=
img
data
[
'image'
]
=
img
outs
=
transform
(
data
,
self
.
ops
)
outs
=
transform
(
data
,
self
.
ops
)
...
...
ppocr/data/simple_dataset.py
浏览文件 @
941869e6
...
@@ -74,7 +74,7 @@ class SimpleDataSet(Dataset):
...
@@ -74,7 +74,7 @@ class SimpleDataSet(Dataset):
file_list
=
[
file_list
]
file_list
=
[
file_list
]
data_lines
=
[]
data_lines
=
[]
for
idx
,
file
in
enumerate
(
file_list
):
for
idx
,
file
in
enumerate
(
file_list
):
with
open
(
file
,
"rb"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
file
,
"rb"
)
as
f
:
lines
=
f
.
readlines
()
lines
=
f
.
readlines
()
if
self
.
mode
==
"train"
or
ratio_list
[
idx
]
<
1.0
:
if
self
.
mode
==
"train"
or
ratio_list
[
idx
]
<
1.0
:
random
.
seed
(
self
.
seed
)
random
.
seed
(
self
.
seed
)
...
@@ -120,7 +120,7 @@ class SimpleDataSet(Dataset):
...
@@ -120,7 +120,7 @@ class SimpleDataSet(Dataset):
data
=
{
'img_path'
:
img_path
,
'label'
:
label
}
data
=
{
'img_path'
:
img_path
,
'label'
:
label
}
if
not
os
.
path
.
exists
(
img_path
):
if
not
os
.
path
.
exists
(
img_path
):
continue
continue
with
open
(
data
[
'img_path'
],
'rb'
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
data
[
'img_path'
],
'rb'
)
as
f
:
img
=
f
.
read
()
img
=
f
.
read
()
data
[
'image'
]
=
img
data
[
'image'
]
=
img
data
=
transform
(
data
,
load_data_ops
)
data
=
transform
(
data
,
load_data_ops
)
...
@@ -146,7 +146,7 @@ class SimpleDataSet(Dataset):
...
@@ -146,7 +146,7 @@ class SimpleDataSet(Dataset):
data
=
{
'img_path'
:
img_path
,
'label'
:
label
}
data
=
{
'img_path'
:
img_path
,
'label'
:
label
}
if
not
os
.
path
.
exists
(
img_path
):
if
not
os
.
path
.
exists
(
img_path
):
raise
Exception
(
"{} does not exist!"
.
format
(
img_path
))
raise
Exception
(
"{} does not exist!"
.
format
(
img_path
))
with
open
(
data
[
'img_path'
],
'rb'
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
data
[
'img_path'
],
'rb'
)
as
f
:
img
=
f
.
read
()
img
=
f
.
read
()
data
[
'image'
]
=
img
data
[
'image'
]
=
img
data
[
'ext_data'
]
=
self
.
get_ext_data
()
data
[
'ext_data'
]
=
self
.
get_ext_data
()
...
@@ -240,7 +240,7 @@ class MultiScaleDataSet(SimpleDataSet):
...
@@ -240,7 +240,7 @@ class MultiScaleDataSet(SimpleDataSet):
data
=
{
'img_path'
:
img_path
,
'label'
:
label
}
data
=
{
'img_path'
:
img_path
,
'label'
:
label
}
if
not
os
.
path
.
exists
(
img_path
):
if
not
os
.
path
.
exists
(
img_path
):
raise
Exception
(
"{} does not exist!"
.
format
(
img_path
))
raise
Exception
(
"{} does not exist!"
.
format
(
img_path
))
with
open
(
data
[
'img_path'
],
'rb'
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
data
[
'img_path'
],
'rb'
)
as
f
:
img
=
f
.
read
()
img
=
f
.
read
()
data
[
'image'
]
=
img
data
[
'image'
]
=
img
data
[
'ext_data'
]
=
self
.
get_ext_data
()
data
[
'ext_data'
]
=
self
.
get_ext_data
()
...
...
ppocr/postprocess/rec_postprocess.py
浏览文件 @
941869e6
...
@@ -31,7 +31,7 @@ class BaseRecLabelDecode(object):
...
@@ -31,7 +31,7 @@ class BaseRecLabelDecode(object):
self
.
character_str
=
"0123456789abcdefghijklmnopqrstuvwxyz"
self
.
character_str
=
"0123456789abcdefghijklmnopqrstuvwxyz"
dict_character
=
list
(
self
.
character_str
)
dict_character
=
list
(
self
.
character_str
)
else
:
else
:
with
open
(
character_dict_path
,
"rb"
,
encoding
=
"utf-8"
)
as
fin
:
with
open
(
character_dict_path
,
"rb"
)
as
fin
:
lines
=
fin
.
readlines
()
lines
=
fin
.
readlines
()
for
line
in
lines
:
for
line
in
lines
:
line
=
line
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
strip
(
"
\r\n
"
)
line
=
line
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
strip
(
"
\r\n
"
)
...
...
ppocr/postprocess/table_postprocess.py
浏览文件 @
941869e6
...
@@ -26,7 +26,7 @@ class TableLabelDecode(AttnLabelDecode):
...
@@ -26,7 +26,7 @@ class TableLabelDecode(AttnLabelDecode):
merge_no_span_structure
=
False
,
merge_no_span_structure
=
False
,
**
kwargs
):
**
kwargs
):
dict_character
=
[]
dict_character
=
[]
with
open
(
character_dict_path
,
"rb"
,
encoding
=
"utf-8"
)
as
fin
:
with
open
(
character_dict_path
,
"rb"
)
as
fin
:
lines
=
fin
.
readlines
()
lines
=
fin
.
readlines
()
for
line
in
lines
:
for
line
in
lines
:
line
=
line
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
strip
(
"
\r\n
"
)
line
=
line
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
strip
(
"
\r\n
"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录