Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
15fd0b31
Commit
15fd0b31
authored
Aug 04, 2020
by
tink2123
Browse files
add error message
parent
f7b5edcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
ppocr/data/rec/dataset_traversal.py
ppocr/data/rec/dataset_traversal.py
+14
-0
No files found.
ppocr/data/rec/dataset_traversal.py
View file @
15fd0b31
...
...
@@ -185,6 +185,7 @@ class SimpleReader(object):
if
params
[
'mode'
]
!=
'test'
:
self
.
img_set_dir
=
params
[
'img_set_dir'
]
self
.
label_file_path
=
params
[
'label_file_path'
]
self
.
use_gpu
=
params
[
'use_gpu'
]
self
.
char_ops
=
params
[
'char_ops'
]
self
.
image_shape
=
params
[
'image_shape'
]
self
.
loss_type
=
params
[
'loss_type'
]
...
...
@@ -213,6 +214,15 @@ class SimpleReader(object):
if
self
.
mode
!=
'train'
:
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
():
if
self
.
mode
!=
'train'
and
self
.
infer_img
is
not
None
:
image_file_list
=
get_image_file_list
(
self
.
infer_img
)
...
...
@@ -237,6 +247,10 @@ class SimpleReader(object):
print
(
"multiprocess is not fully compatible with Windows."
"num_workers will be 1."
)
self
.
num_workers
=
1
if
self
.
batch_size
*
get_device_num
()
>
img_num
:
logger
.
error
(
"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
):
label_infor
=
label_infor_list
[
img_id_list
[
img_id
]]
substr
=
label_infor
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
split
(
"
\t
"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment