Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
57e0565a
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看板
未验证
提交
57e0565a
编写于
8月 06, 2020
作者:
D
dyning
提交者:
GitHub
8月 06, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #481 from tink2123/add_error_message
add error message
上级
a0c8968c
f498a63f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
0 deletion
+14
-0
ppocr/data/rec/dataset_traversal.py
ppocr/data/rec/dataset_traversal.py
+14
-0
未找到文件。
ppocr/data/rec/dataset_traversal.py
浏览文件 @
57e0565a
...
@@ -185,6 +185,7 @@ class SimpleReader(object):
...
@@ -185,6 +185,7 @@ class SimpleReader(object):
if
params
[
'mode'
]
!=
'test'
:
if
params
[
'mode'
]
!=
'test'
:
self
.
img_set_dir
=
params
[
'img_set_dir'
]
self
.
img_set_dir
=
params
[
'img_set_dir'
]
self
.
label_file_path
=
params
[
'label_file_path'
]
self
.
label_file_path
=
params
[
'label_file_path'
]
self
.
use_gpu
=
params
[
'use_gpu'
]
self
.
char_ops
=
params
[
'char_ops'
]
self
.
char_ops
=
params
[
'char_ops'
]
self
.
image_shape
=
params
[
'image_shape'
]
self
.
image_shape
=
params
[
'image_shape'
]
self
.
loss_type
=
params
[
'loss_type'
]
self
.
loss_type
=
params
[
'loss_type'
]
...
@@ -213,6 +214,15 @@ class SimpleReader(object):
...
@@ -213,6 +214,15 @@ class SimpleReader(object):
if
self
.
mode
!=
'train'
:
if
self
.
mode
!=
'train'
:
process_id
=
0
process_id
=
0
def
get_device_num
():
if
self
.
use_gpu
:
gpus
=
os
.
environ
.
get
(
"CUDA_VISIBLE_DEVICES"
,
1
)
gpu_num
=
len
(
gpus
.
split
(
','
))
return
gpu_num
else
:
cpu_num
=
os
.
environ
.
get
(
"CPU_NUM"
,
1
)
return
int
(
cpu_num
)
def
sample_iter_reader
():
def
sample_iter_reader
():
if
self
.
mode
!=
'train'
and
self
.
infer_img
is
not
None
:
if
self
.
mode
!=
'train'
and
self
.
infer_img
is
not
None
:
image_file_list
=
get_image_file_list
(
self
.
infer_img
)
image_file_list
=
get_image_file_list
(
self
.
infer_img
)
...
@@ -237,6 +247,10 @@ class SimpleReader(object):
...
@@ -237,6 +247,10 @@ class SimpleReader(object):
print
(
"multiprocess is not fully compatible with Windows."
print
(
"multiprocess is not fully compatible with Windows."
"num_workers will be 1."
)
"num_workers will be 1."
)
self
.
num_workers
=
1
self
.
num_workers
=
1
if
self
.
batch_size
*
get_device_num
()
>
img_num
:
raise
Exception
(
"The number of the whole data ({}) is smaller than the batch_size * devices_num ({})"
.
format
(
img_num
,
self
.
batch_size
*
get_device_num
()))
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
"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录