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
efbb0aba
Unverified
Commit
efbb0aba
authored
May 09, 2022
by
xiaoting
Committed by
GitHub
May 09, 2022
Browse files
modified default shape (#6211)
* modified default shape * modified default shape
parent
92d01dd1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+9
-5
tools/infer/predict_system.py
tools/infer/predict_system.py
+3
-0
tools/infer/utility.py
tools/infer/utility.py
+1
-1
No files found.
tools/infer/predict_rec.py
View file @
efbb0aba
...
@@ -296,8 +296,8 @@ class TextRecognizer(object):
...
@@ -296,8 +296,8 @@ class TextRecognizer(object):
gsrm_slf_attn_bias2_list
.
append
(
norm_img
[
4
])
gsrm_slf_attn_bias2_list
.
append
(
norm_img
[
4
])
norm_img_batch
.
append
(
norm_img
[
0
])
norm_img_batch
.
append
(
norm_img
[
0
])
elif
self
.
rec_algorithm
==
"SVTR"
:
elif
self
.
rec_algorithm
==
"SVTR"
:
norm_img
=
self
.
resize_norm_img_svtr
(
norm_img
=
self
.
resize_norm_img_svtr
(
img_list
[
indices
[
ino
]],
img_list
[
indices
[
ino
]],
self
.
rec_image_shape
)
self
.
rec_image_shape
)
norm_img
=
norm_img
[
np
.
newaxis
,
:]
norm_img
=
norm_img
[
np
.
newaxis
,
:]
norm_img_batch
.
append
(
norm_img
)
norm_img_batch
.
append
(
norm_img
)
else
:
else
:
...
@@ -405,9 +405,13 @@ def main(args):
...
@@ -405,9 +405,13 @@ def main(args):
valid_image_file_list
=
[]
valid_image_file_list
=
[]
img_list
=
[]
img_list
=
[]
logger
.
info
(
"In PP-OCRv3, rec_image_shape parameter defaults to '3, 48, 320', "
"if you are using recognition model with PP-OCRv2 or an older version, please set --rec_image_shape='3,32,320"
)
# warmup 2 times
# warmup 2 times
if
args
.
warmup
:
if
args
.
warmup
:
img
=
np
.
random
.
uniform
(
0
,
255
,
[
32
,
320
,
3
]).
astype
(
np
.
uint8
)
img
=
np
.
random
.
uniform
(
0
,
255
,
[
48
,
320
,
3
]).
astype
(
np
.
uint8
)
for
i
in
range
(
2
):
for
i
in
range
(
2
):
res
=
text_recognizer
([
img
]
*
int
(
args
.
rec_batch_num
))
res
=
text_recognizer
([
img
]
*
int
(
args
.
rec_batch_num
))
...
...
tools/infer/predict_system.py
View file @
efbb0aba
...
@@ -133,6 +133,9 @@ def main(args):
...
@@ -133,6 +133,9 @@ def main(args):
os
.
makedirs
(
draw_img_save_dir
,
exist_ok
=
True
)
os
.
makedirs
(
draw_img_save_dir
,
exist_ok
=
True
)
save_results
=
[]
save_results
=
[]
logger
.
info
(
"In PP-OCRv3, rec_image_shape parameter defaults to '3, 48, 320', "
"if you are using recognition model with PP-OCRv2 or an older version, please set --rec_image_shape='3,32,320"
)
# warm up 10 times
# warm up 10 times
if
args
.
warmup
:
if
args
.
warmup
:
img
=
np
.
random
.
uniform
(
0
,
255
,
[
640
,
640
,
3
]).
astype
(
np
.
uint8
)
img
=
np
.
random
.
uniform
(
0
,
255
,
[
640
,
640
,
3
]).
astype
(
np
.
uint8
)
...
...
tools/infer/utility.py
View file @
efbb0aba
...
@@ -81,7 +81,7 @@ def init_args():
...
@@ -81,7 +81,7 @@ def init_args():
# params for text recognizer
# params for text recognizer
parser
.
add_argument
(
"--rec_algorithm"
,
type
=
str
,
default
=
'CRNN'
)
parser
.
add_argument
(
"--rec_algorithm"
,
type
=
str
,
default
=
'CRNN'
)
parser
.
add_argument
(
"--rec_model_dir"
,
type
=
str
)
parser
.
add_argument
(
"--rec_model_dir"
,
type
=
str
)
parser
.
add_argument
(
"--rec_image_shape"
,
type
=
str
,
default
=
"3,
32
, 320"
)
parser
.
add_argument
(
"--rec_image_shape"
,
type
=
str
,
default
=
"3,
48
, 320"
)
parser
.
add_argument
(
"--rec_batch_num"
,
type
=
int
,
default
=
6
)
parser
.
add_argument
(
"--rec_batch_num"
,
type
=
int
,
default
=
6
)
parser
.
add_argument
(
"--max_text_length"
,
type
=
int
,
default
=
25
)
parser
.
add_argument
(
"--max_text_length"
,
type
=
int
,
default
=
25
)
parser
.
add_argument
(
parser
.
add_argument
(
...
...
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