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
0507331f
Unverified
Commit
0507331f
authored
Apr 19, 2022
by
MissPenguin
Committed by
GitHub
Apr 19, 2022
Browse files
Merge branch 'dygraph' into dygraph
parents
2cdaa0f8
39b831b9
Changes
62
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+4
-0
tools/infer/utility.py
tools/infer/utility.py
+17
-3
No files found.
tools/infer/predict_rec.py
View file @
0507331f
...
@@ -119,6 +119,10 @@ class TextRecognizer(object):
...
@@ -119,6 +119,10 @@ class TextRecognizer(object):
resized_w
=
imgW
resized_w
=
imgW
else
:
else
:
resized_w
=
int
(
math
.
ceil
(
imgH
*
ratio
))
resized_w
=
int
(
math
.
ceil
(
imgH
*
ratio
))
if
self
.
rec_algorithm
==
'RARE'
:
if
resized_w
>
self
.
rec_image_shape
[
2
]:
resized_w
=
self
.
rec_image_shape
[
2
]
imgW
=
self
.
rec_image_shape
[
2
]
resized_image
=
cv2
.
resize
(
img
,
(
resized_w
,
imgH
))
resized_image
=
cv2
.
resize
(
img
,
(
resized_w
,
imgH
))
resized_image
=
resized_image
.
astype
(
'float32'
)
resized_image
=
resized_image
.
astype
(
'float32'
)
resized_image
=
resized_image
.
transpose
((
2
,
0
,
1
))
/
255
resized_image
=
resized_image
.
transpose
((
2
,
0
,
1
))
/
255
...
...
tools/infer/utility.py
View file @
0507331f
...
@@ -312,12 +312,26 @@ def create_predictor(args, mode, logger):
...
@@ -312,12 +312,26 @@ def create_predictor(args, mode, logger):
input_names
=
predictor
.
get_input_names
()
input_names
=
predictor
.
get_input_names
()
for
name
in
input_names
:
for
name
in
input_names
:
input_tensor
=
predictor
.
get_input_handle
(
name
)
input_tensor
=
predictor
.
get_input_handle
(
name
)
output_tensors
=
get_output_tensors
(
args
,
mode
,
predictor
)
return
predictor
,
input_tensor
,
output_tensors
,
config
def
get_output_tensors
(
args
,
mode
,
predictor
):
output_names
=
predictor
.
get_output_names
()
output_names
=
predictor
.
get_output_names
()
output_tensors
=
[]
output_tensors
=
[]
if
mode
==
"rec"
and
args
.
rec_algorithm
==
"CRNN"
:
output_name
=
'softmax_0.tmp_0'
if
output_name
in
output_names
:
return
[
predictor
.
get_output_handle
(
output_name
)]
else
:
for
output_name
in
output_names
:
for
output_name
in
output_names
:
output_tensor
=
predictor
.
get_output_handle
(
output_name
)
output_tensor
=
predictor
.
get_output_handle
(
output_name
)
output_tensors
.
append
(
output_tensor
)
output_tensors
.
append
(
output_tensor
)
return
predictor
,
input_tensor
,
output_tensors
,
config
else
:
for
output_name
in
output_names
:
output_tensor
=
predictor
.
get_output_handle
(
output_name
)
output_tensors
.
append
(
output_tensor
)
return
output_tensors
def
get_infer_gpuid
():
def
get_infer_gpuid
():
...
...
Prev
1
2
3
4
Next
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