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
51e0dd4a
Unverified
Commit
51e0dd4a
authored
Jul 10, 2020
by
dyning
Committed by
GitHub
Jul 10, 2020
Browse files
Merge pull request #299 from LDOUBLEV/cpu_opt
modify normalization of db_process to speed up
parents
244a06d5
13e59395
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
ppocr/data/det/db_process.py
ppocr/data/det/db_process.py
+6
-2
ppocr/data/rec/img_tools.py
ppocr/data/rec/img_tools.py
+1
-1
No files found.
ppocr/data/det/db_process.py
View file @
51e0dd4a
...
@@ -194,8 +194,12 @@ class DBProcessTest(object):
...
@@ -194,8 +194,12 @@ class DBProcessTest(object):
img_std
=
[
0.229
,
0.224
,
0.225
]
img_std
=
[
0.229
,
0.224
,
0.225
]
im
=
im
.
astype
(
np
.
float32
,
copy
=
False
)
im
=
im
.
astype
(
np
.
float32
,
copy
=
False
)
im
=
im
/
255
im
=
im
/
255
im
-=
img_mean
im
[:,
:,
0
]
-=
img_mean
[
0
]
im
/=
img_std
im
[:,
:,
1
]
-=
img_mean
[
1
]
im
[:,
:,
2
]
-=
img_mean
[
2
]
im
[:,
:,
0
]
/=
img_std
[
0
]
im
[:,
:,
1
]
/=
img_std
[
1
]
im
[:,
:,
2
]
/=
img_std
[
2
]
channel_swap
=
(
2
,
0
,
1
)
channel_swap
=
(
2
,
0
,
1
)
im
=
im
.
transpose
(
channel_swap
)
im
=
im
.
transpose
(
channel_swap
)
return
im
return
im
...
...
ppocr/data/rec/img_tools.py
View file @
51e0dd4a
...
@@ -360,7 +360,7 @@ def process_image(img,
...
@@ -360,7 +360,7 @@ def process_image(img,
text
=
char_ops
.
encode
(
label
)
text
=
char_ops
.
encode
(
label
)
if
len
(
text
)
==
0
or
len
(
text
)
>
max_text_length
:
if
len
(
text
)
==
0
or
len
(
text
)
>
max_text_length
:
logger
.
info
(
logger
.
info
(
"Warning in ppocr/data/rec/img_tools.py:line
106
: Wrong data type."
"Warning in ppocr/data/rec/img_tools.py:line
362
: Wrong data type."
"Excepted string with length between 1 and {}, but "
"Excepted string with length between 1 and {}, but "
"got '{}'. Label is '{}'"
.
format
(
max_text_length
,
"got '{}'. Label is '{}'"
.
format
(
max_text_length
,
len
(
text
),
label
))
len
(
text
),
label
))
...
...
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