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
d671fefd
Unverified
Commit
d671fefd
authored
Jul 14, 2020
by
dyning
Committed by
GitHub
Jul 14, 2020
Browse files
Merge pull request #327 from MissPenguin/develop
add parameter enable_mkldnn
parents
21c4934e
4e427410
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
doc/doc_ch/benchmark.md
doc/doc_ch/benchmark.md
+11
-3
tools/infer/predict_system.py
tools/infer/predict_system.py
+4
-0
tools/infer/utility.py
tools/infer/utility.py
+5
-2
No files found.
doc/doc_ch/benchmark.md
View file @
d671fefd
...
@@ -16,6 +16,14 @@
...
@@ -16,6 +16,14 @@
|480|0.057|0.043|0.241| 0.175|
|480|0.057|0.043|0.241| 0.175|
说明:
说明:
-
评估耗时阶段为图像输入到结果输出的完整阶段,包括了图像的预处理和后处理。
-
评估耗时阶段为图像输入到结果输出的完整阶段,包括了图像的预处理和后处理。
-
`Intel至强6148`
为服务器端CPU型号,目前正在调试使用Intel MKL-DNN 进一步加速CPU预测速度。
-
`Intel至强6148`
为服务器端CPU型号,测试中使用Intel MKL-DNN 加速CPU预测速度,使用该操作需要:
-
`骁龙855`
为移动端处理平台型号。
-
更新到飞桨latest版本:https://www.paddlepaddle.org.cn/documentation/docs/zh/install/Tables.html#whl-dev ,请根据自己环境的CUDA版本和Python版本选择相应的mkl版wheel包,如,CUDA10、Python3.7环境,应操作:
```
shell
# 获取安装包
wget https://paddle-wheel.bj.bcebos.com/0.0.0-gpu-cuda10-cudnn7-mkl/paddlepaddle_gpu-0.0.0-cp37-cp37m-linux_x86_64.whl
# 安装
pip3.7
install
paddlepaddle_gpu-0.0.0-cp37-cp37m-linux_x86_64.whl
```
-
预测时使用参数打开加速开关:
`--enable_mkldnn True`
-
`骁龙855`
为移动端处理平台型号。
tools/infer/predict_system.py
View file @
d671fefd
...
@@ -117,12 +117,16 @@ def main(args):
...
@@ -117,12 +117,16 @@ def main(args):
image_file_list
=
get_image_file_list
(
args
.
image_dir
)
image_file_list
=
get_image_file_list
(
args
.
image_dir
)
text_sys
=
TextSystem
(
args
)
text_sys
=
TextSystem
(
args
)
is_visualize
=
True
is_visualize
=
True
tackle_img_num
=
0
for
image_file
in
image_file_list
:
for
image_file
in
image_file_list
:
img
=
cv2
.
imread
(
image_file
)
img
=
cv2
.
imread
(
image_file
)
if
img
is
None
:
if
img
is
None
:
logger
.
info
(
"error in loading image:{}"
.
format
(
image_file
))
logger
.
info
(
"error in loading image:{}"
.
format
(
image_file
))
continue
continue
starttime
=
time
.
time
()
starttime
=
time
.
time
()
tackle_img_num
+=
1
if
not
args
.
use_gpu
and
args
.
enable_mkldnn
and
tackle_img_num
%
30
==
0
:
text_sys
=
TextSystem
(
args
)
dt_boxes
,
rec_res
=
text_sys
(
img
)
dt_boxes
,
rec_res
=
text_sys
(
img
)
elapse
=
time
.
time
()
-
starttime
elapse
=
time
.
time
()
-
starttime
print
(
"Predict time of %s: %.3fs"
%
(
image_file
,
elapse
))
print
(
"Predict time of %s: %.3fs"
%
(
image_file
,
elapse
))
...
...
tools/infer/utility.py
View file @
d671fefd
...
@@ -64,6 +64,7 @@ def parse_args():
...
@@ -64,6 +64,7 @@ def parse_args():
type
=
str
,
type
=
str
,
default
=
"./ppocr/utils/ppocr_keys_v1.txt"
)
default
=
"./ppocr/utils/ppocr_keys_v1.txt"
)
parser
.
add_argument
(
"--use_space_char"
,
type
=
bool
,
default
=
True
)
parser
.
add_argument
(
"--use_space_char"
,
type
=
bool
,
default
=
True
)
parser
.
add_argument
(
"--enable_mkldnn"
,
type
=
bool
,
default
=
False
)
return
parser
.
parse_args
()
return
parser
.
parse_args
()
...
@@ -91,8 +92,10 @@ def create_predictor(args, mode):
...
@@ -91,8 +92,10 @@ def create_predictor(args, mode):
config
.
enable_use_gpu
(
args
.
gpu_mem
,
0
)
config
.
enable_use_gpu
(
args
.
gpu_mem
,
0
)
else
:
else
:
config
.
disable_gpu
()
config
.
disable_gpu
()
# config.enable_mkldnn()
config
.
set_cpu_math_library_num_threads
(
6
)
config
.
set_cpu_math_library_num_threads
(
4
)
if
args
.
enable_mkldnn
:
config
.
enable_mkldnn
()
#config.enable_memory_optim()
#config.enable_memory_optim()
config
.
disable_glog_info
()
config
.
disable_glog_info
()
...
...
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