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
cdd98d08
Unverified
Commit
cdd98d08
authored
Jun 29, 2021
by
Double_V
Committed by
GitHub
Jun 29, 2021
Browse files
Update predict_det.py
parent
e4d49819
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
tools/infer/predict_det.py
tools/infer/predict_det.py
+12
-8
No files found.
tools/infer/predict_det.py
View file @
cdd98d08
...
@@ -174,8 +174,9 @@ class TextDetector(object):
...
@@ -174,8 +174,9 @@ class TextDetector(object):
data
=
{
'image'
:
img
}
data
=
{
'image'
:
img
}
st
=
time
.
time
()
st
=
time
.
time
()
self
.
autolog
.
times
.
start
()
if
args
.
benchmark
:
self
.
autolog
.
times
.
start
()
data
=
transform
(
data
,
self
.
preprocess_op
)
data
=
transform
(
data
,
self
.
preprocess_op
)
img
,
shape_list
=
data
img
,
shape_list
=
data
...
@@ -185,7 +186,8 @@ class TextDetector(object):
...
@@ -185,7 +186,8 @@ class TextDetector(object):
shape_list
=
np
.
expand_dims
(
shape_list
,
axis
=
0
)
shape_list
=
np
.
expand_dims
(
shape_list
,
axis
=
0
)
img
=
img
.
copy
()
img
=
img
.
copy
()
self
.
autolog
.
times
.
stamp
()
if
args
.
benchmark
:
self
.
autolog
.
times
.
stamp
()
self
.
input_tensor
.
copy_from_cpu
(
img
)
self
.
input_tensor
.
copy_from_cpu
(
img
)
self
.
predictor
.
run
()
self
.
predictor
.
run
()
...
@@ -193,8 +195,8 @@ class TextDetector(object):
...
@@ -193,8 +195,8 @@ class TextDetector(object):
for
output_tensor
in
self
.
output_tensors
:
for
output_tensor
in
self
.
output_tensors
:
output
=
output_tensor
.
copy_to_cpu
()
output
=
output_tensor
.
copy_to_cpu
()
outputs
.
append
(
output
)
outputs
.
append
(
output
)
if
args
.
benchmark
:
self
.
autolog
.
times
.
stamp
()
self
.
autolog
.
times
.
stamp
()
preds
=
{}
preds
=
{}
if
self
.
det_algorithm
==
"EAST"
:
if
self
.
det_algorithm
==
"EAST"
:
...
@@ -218,7 +220,8 @@ class TextDetector(object):
...
@@ -218,7 +220,8 @@ class TextDetector(object):
else
:
else
:
dt_boxes
=
self
.
filter_tag_det_res
(
dt_boxes
,
ori_im
.
shape
)
dt_boxes
=
self
.
filter_tag_det_res
(
dt_boxes
,
ori_im
.
shape
)
self
.
autolog
.
times
.
end
(
stamp
=
True
)
if
args
.
benchmark
:
self
.
autolog
.
times
.
end
(
stamp
=
True
)
et
=
time
.
time
()
et
=
time
.
time
()
return
dt_boxes
,
et
-
st
return
dt_boxes
,
et
-
st
...
@@ -259,6 +262,7 @@ if __name__ == "__main__":
...
@@ -259,6 +262,7 @@ if __name__ == "__main__":
"det_res_{}"
.
format
(
img_name_pure
))
"det_res_{}"
.
format
(
img_name_pure
))
cv2
.
imwrite
(
img_path
,
src_im
)
cv2
.
imwrite
(
img_path
,
src_im
)
logger
.
info
(
"The visualized image saved in {}"
.
format
(
img_path
))
logger
.
info
(
"The visualized image saved in {}"
.
format
(
img_path
))
text_detector
.
autolog
.
report
()
if
args
.
benchmark
:
text_detector
.
autolog
.
report
()
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