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
c63624b3
Unverified
Commit
c63624b3
authored
May 25, 2020
by
xiaoting
Committed by
GitHub
May 25, 2020
Browse files
Merge pull request #94 from tink2123/win
Adaptive Windows
parents
6081c67b
53952a46
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
3 deletions
+16
-3
ppocr/data/det/dataset_traversal.py
ppocr/data/det/dataset_traversal.py
+5
-0
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
No files found.
ppocr/data/det/dataset_traversal.py
100755 → 100644
View file @
c63624b3
...
...
@@ -13,6 +13,7 @@
#limitations under the License.
import
os
import
sys
import
math
import
random
import
functools
...
...
@@ -42,6 +43,10 @@ class TrainReader(object):
img_num
=
len
(
label_infor_list
)
img_id_list
=
list
(
range
(
img_num
))
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
):
label_infor
=
label_infor_list
[
img_id_list
[
img_id
]]
outs
=
self
.
process
(
label_infor
)
...
...
ppocr/data/reader_main.py
View file @
c63624b3
...
...
@@ -66,6 +66,8 @@ def reader_main(config=None, mode=None):
reader_function
=
params
[
'reader_function'
]
function
=
create_module
(
reader_function
)(
params
)
if
mode
==
"train"
:
if
sys
.
platform
==
"win32"
:
return
function
(
0
)
readers
=
[]
num_workers
=
params
[
'num_workers'
]
for
process_id
in
range
(
num_workers
):
...
...
ppocr/data/rec/dataset_traversal.py
View file @
c63624b3
...
...
@@ -13,6 +13,7 @@
#limitations under the License.
import
os
import
sys
import
math
import
random
import
numpy
as
np
...
...
@@ -191,16 +192,21 @@ class SimpleReader(object):
img_num
=
len
(
label_infor_list
)
img_id_list
=
list
(
range
(
img_num
))
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
):
label_infor
=
label_infor_list
[
img_id_list
[
img_id
]]
substr
=
label_infor
.
decode
(
'utf-8'
).
strip
(
"
\n
"
).
split
(
"
\t
"
)
img_path
=
self
.
img_set_dir
+
"/"
+
substr
[
0
]
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
:
logger
.
info
(
"{} does not exist!"
.
format
(
img_path
))
continue
if
img
.
shape
[
-
1
]
==
1
or
len
(
list
(
img
.
shape
))
==
2
:
img
=
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_GRAY2BGR
)
label
=
substr
[
1
]
outs
=
process_image
(
img
,
self
.
image_shape
,
label
,
self
.
char_ops
,
self
.
loss_type
,
...
...
ppocr/utils/character.py
View file @
c63624b3
...
...
@@ -34,7 +34,7 @@ class CharacterOps(object):
with
open
(
character_dict_path
,
"rb"
)
as
fin
:
lines
=
fin
.
readlines
()
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
dict_character
=
list
(
self
.
character_str
)
elif
self
.
character_type
==
"en_sensitive"
:
...
...
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