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
7852d0d6
Commit
7852d0d6
authored
Dec 30, 2021
by
redearly123/PaddleOCR
Browse files
Merge branch 'dygraph' of
https://github.com/PaddlePaddle/PaddleOCR
into dygraph
update
parents
0d8ac34b
63bcb2a9
Changes
63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
7 deletions
+20
-7
tools/infer/predict_det.py
tools/infer/predict_det.py
+11
-6
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+4
-1
tools/infer/utility.py
tools/infer/utility.py
+5
-0
No files found.
tools/infer/predict_det.py
View file @
7852d0d6
...
@@ -101,17 +101,22 @@ class TextDetector(object):
...
@@ -101,17 +101,22 @@ class TextDetector(object):
else
:
else
:
logger
.
info
(
"unknown det_algorithm:{}"
.
format
(
self
.
det_algorithm
))
logger
.
info
(
"unknown det_algorithm:{}"
.
format
(
self
.
det_algorithm
))
sys
.
exit
(
0
)
sys
.
exit
(
0
)
if
self
.
use_onnx
:
pre_process_list
[
0
]
=
{
'DetResizeForTest'
:
{
'image_shape'
:
[
640
,
640
]
}
}
self
.
preprocess_op
=
create_operators
(
pre_process_list
)
self
.
preprocess_op
=
create_operators
(
pre_process_list
)
self
.
postprocess_op
=
build_post_process
(
postprocess_params
)
self
.
postprocess_op
=
build_post_process
(
postprocess_params
)
self
.
predictor
,
self
.
input_tensor
,
self
.
output_tensors
,
self
.
config
=
utility
.
create_predictor
(
self
.
predictor
,
self
.
input_tensor
,
self
.
output_tensors
,
self
.
config
=
utility
.
create_predictor
(
args
,
'det'
,
logger
)
args
,
'det'
,
logger
)
if
self
.
use_onnx
:
img_h
,
img_w
=
self
.
input_tensor
.
shape
[
2
:]
if
img_h
is
not
None
and
img_w
is
not
None
and
img_h
>
0
and
img_w
>
0
:
pre_process_list
[
0
]
=
{
'DetResizeForTest'
:
{
'image_shape'
:
[
img_h
,
img_w
]
}
}
self
.
preprocess_op
=
create_operators
(
pre_process_list
)
if
args
.
benchmark
:
if
args
.
benchmark
:
import
auto_log
import
auto_log
pid
=
os
.
getpid
()
pid
=
os
.
getpid
()
...
...
tools/infer/predict_rec.py
View file @
7852d0d6
...
@@ -109,7 +109,10 @@ class TextRecognizer(object):
...
@@ -109,7 +109,10 @@ class TextRecognizer(object):
assert
imgC
==
img
.
shape
[
2
]
assert
imgC
==
img
.
shape
[
2
]
imgW
=
int
((
32
*
max_wh_ratio
))
imgW
=
int
((
32
*
max_wh_ratio
))
if
self
.
use_onnx
:
if
self
.
use_onnx
:
imgW
=
100
w
=
self
.
input_tensor
.
shape
[
3
:][
0
]
if
w
is
not
None
and
w
>
0
:
imgW
=
w
h
,
w
=
img
.
shape
[:
2
]
h
,
w
=
img
.
shape
[:
2
]
ratio
=
w
/
float
(
h
)
ratio
=
w
/
float
(
h
)
if
math
.
ceil
(
imgH
*
ratio
)
>
imgW
:
if
math
.
ceil
(
imgH
*
ratio
)
>
imgW
:
...
...
tools/infer/utility.py
View file @
7852d0d6
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
import
argparse
import
argparse
import
os
import
os
import
sys
import
sys
import
platform
import
cv2
import
cv2
import
numpy
as
np
import
numpy
as
np
import
paddle
import
paddle
...
@@ -313,6 +314,10 @@ def create_predictor(args, mode, logger):
...
@@ -313,6 +314,10 @@ def create_predictor(args, mode, logger):
def
get_infer_gpuid
():
def
get_infer_gpuid
():
sysstr
=
platform
.
system
()
if
sysstr
==
"Windows"
:
return
0
if
not
paddle
.
fluid
.
core
.
is_compiled_with_rocm
():
if
not
paddle
.
fluid
.
core
.
is_compiled_with_rocm
():
cmd
=
"env | grep CUDA_VISIBLE_DEVICES"
cmd
=
"env | grep CUDA_VISIBLE_DEVICES"
else
:
else
:
...
...
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