Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
e5a2062d
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看板
提交
e5a2062d
编写于
5月 25, 2020
作者:
T
tink2123
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adaptive Windows
上级
e8a16963
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
3 deletion
+11
-3
ppocr/data/reader_main.py
ppocr/data/reader_main.py
+2
-0
ppocr/data/rec/dataset_traversal.py
ppocr/data/rec/dataset_traversal.py
+8
-2
ppocr/utils/character.py
ppocr/utils/character.py
+1
-1
未找到文件。
ppocr/data/reader_main.py
浏览文件 @
e5a2062d
...
@@ -66,6 +66,8 @@ def reader_main(config=None, mode=None):
...
@@ -66,6 +66,8 @@ def reader_main(config=None, mode=None):
reader_function
=
params
[
'reader_function'
]
reader_function
=
params
[
'reader_function'
]
function
=
create_module
(
reader_function
)(
params
)
function
=
create_module
(
reader_function
)(
params
)
if
mode
==
"train"
:
if
mode
==
"train"
:
if
sys
.
platform
==
"win32"
:
return
function
(
0
)
readers
=
[]
readers
=
[]
num_workers
=
params
[
'num_workers'
]
num_workers
=
params
[
'num_workers'
]
for
process_id
in
range
(
num_workers
):
for
process_id
in
range
(
num_workers
):
...
...
ppocr/data/rec/dataset_traversal.py
浏览文件 @
e5a2062d
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#limitations under the License.
#limitations under the License.
import
os
import
os
import
sys
import
math
import
math
import
random
import
random
import
numpy
as
np
import
numpy
as
np
...
@@ -191,16 +192,21 @@ class SimpleReader(object):
...
@@ -191,16 +192,21 @@ class SimpleReader(object):
img_num
=
len
(
label_infor_list
)
img_num
=
len
(
label_infor_list
)
img_id_list
=
list
(
range
(
img_num
))
img_id_list
=
list
(
range
(
img_num
))
random
.
shuffle
(
img_id_list
)
random
.
shuffle
(
img_id_list
)
if
sys
.
platform
==
"win32"
:
print
(
"multiprocess is not fully compatible with Windows."
"num_workers will be 1."
)
self
.
num_workers
=
1
for
img_id
in
range
(
process_id
,
img_num
,
self
.
num_workers
):
for
img_id
in
range
(
process_id
,
img_num
,
self
.
num_workers
):
label_infor
=
label_infor_list
[
img_id_list
[
img_id
]]
label_infor
=
label_infor_list
[
img_id_list
[
img_id
]]
substr
=
label_infor
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
split
(
"
\t
"
)
substr
=
label_infor
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
split
(
"
\t
"
)
img_path
=
self
.
img_set_dir
+
"/"
+
substr
[
0
]
img_path
=
self
.
img_set_dir
+
"/"
+
substr
[
0
]
img
=
cv2
.
imread
(
img_path
)
img
=
cv2
.
imread
(
img_path
)
if
img
.
shape
[
-
1
]
==
1
or
len
(
list
(
img
.
shape
))
==
2
:
img
=
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_GRAY2BGR
)
if
img
is
None
:
if
img
is
None
:
logger
.
info
(
"{} does not exist!"
.
format
(
img_path
))
logger
.
info
(
"{} does not exist!"
.
format
(
img_path
))
continue
continue
if
img
.
shape
[
-
1
]
==
1
or
len
(
list
(
img
.
shape
))
==
2
:
img
=
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_GRAY2BGR
)
label
=
substr
[
1
]
label
=
substr
[
1
]
outs
=
process_image
(
img
,
self
.
image_shape
,
label
,
outs
=
process_image
(
img
,
self
.
image_shape
,
label
,
self
.
char_ops
,
self
.
loss_type
,
self
.
char_ops
,
self
.
loss_type
,
...
...
ppocr/utils/character.py
浏览文件 @
e5a2062d
...
@@ -34,7 +34,7 @@ class CharacterOps(object):
...
@@ -34,7 +34,7 @@ class CharacterOps(object):
with
open
(
character_dict_path
,
"rb"
)
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
"
)
line
=
line
.
decode
(
'utf-8'
).
strip
(
"
\n
"
)
.
strip
(
"
\r\n
"
)
self
.
character_str
+=
line
self
.
character_str
+=
line
dict_character
=
list
(
self
.
character_str
)
dict_character
=
list
(
self
.
character_str
)
elif
self
.
character_type
==
"en_sensitive"
:
elif
self
.
character_type
==
"en_sensitive"
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录