Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
5d248b16
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
大约 1 年 前同步成功
通知
1525
Star
32962
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5d248b16
编写于
9月 16, 2020
作者:
W
WenmuZhou
浏览文件
操作
浏览文件
下载
差异文件
解决冲突
上级
99f253bc
00a889e1
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
16 addition
and
25 deletion
+16
-25
deploy/cpp_infer/src/ocr_det.cpp
deploy/cpp_infer/src/ocr_det.cpp
+2
-0
deploy/cpp_infer/src/ocr_rec.cpp
deploy/cpp_infer/src/ocr_rec.cpp
+2
-0
deploy/cpp_infer/tools/config.txt
deploy/cpp_infer/tools/config.txt
+8
-7
deploy/docker/hubserving/README.md
deploy/docker/hubserving/README.md
+1
-1
deploy/docker/hubserving/README_cn.md
deploy/docker/hubserving/README_cn.md
+1
-1
deploy/docker/hubserving/cpu/Dockerfile
deploy/docker/hubserving/cpu/Dockerfile
+0
-0
deploy/docker/hubserving/gpu/Dockerfile
deploy/docker/hubserving/gpu/Dockerfile
+0
-0
deploy/docker/hubserving/sample_request.txt
deploy/docker/hubserving/sample_request.txt
+0
-0
ppocr/utils/utility.py
ppocr/utils/utility.py
+0
-12
tools/infer/predict_system.py
tools/infer/predict_system.py
+0
-4
tools/infer/utility.py
tools/infer/utility.py
+2
-0
未找到文件。
deploy/cpp_infer/src/ocr_det.cpp
浏览文件 @
5d248b16
...
...
@@ -26,6 +26,8 @@ void DBDetector::LoadModel(const std::string &model_dir) {
config
.
DisableGpu
();
if
(
this
->
use_mkldnn_
)
{
config
.
EnableMKLDNN
();
// cache 10 different shapes for mkldnn to avoid memory leak
config
.
SetMkldnnCacheCapacity
(
10
);
}
config
.
SetCpuMathLibraryNumThreads
(
this
->
cpu_math_library_num_threads_
);
}
...
...
deploy/cpp_infer/src/ocr_rec.cpp
浏览文件 @
5d248b16
...
...
@@ -129,6 +129,8 @@ void CRNNRecognizer::LoadModel(const std::string &model_dir) {
config
.
DisableGpu
();
if
(
this
->
use_mkldnn_
)
{
config
.
EnableMKLDNN
();
// cache 10 different shapes for mkldnn to avoid memory leak
config
.
SetMkldnnCacheCapacity
(
10
);
}
config
.
SetCpuMathLibraryNumThreads
(
this
->
cpu_math_library_num_threads_
);
}
...
...
deploy/cpp_infer/tools/config.txt
浏览文件 @
5d248b16
...
...
@@ -3,24 +3,25 @@ use_gpu 0
gpu_id 0
gpu_mem 4000
cpu_math_library_num_threads 10
use_mkldnn
0
use_zero_copy_run
0
use_mkldnn
1
use_zero_copy_run
1
# det config
max_side_len 960
det_db_thresh 0.3
det_db_box_thresh 0.5
det_db_unclip_ratio 2.0
det_model_dir .
./model/det
det_model_dir .
/inference/det_db
# cls config
use_angle_cls 0
cls_model_dir ../
model
/cls
cls_model_dir ../
inference
/cls
cls_thresh 0.9
# rec config
rec_model_dir .
./model/rec
char_list_file ../
model
/ppocr_keys_v1.txt
rec_model_dir .
/inference/rec_crnn
char_list_file ../
../ppocr/utils
/ppocr_keys_v1.txt
# show the detection results
visualize 1
\ No newline at end of file
visualize 1
docker/hubserving/README.md
→
d
eploy/d
ocker/hubserving/README.md
浏览文件 @
5d248b16
...
...
@@ -20,7 +20,7 @@ git clone https://github.com/PaddlePaddle/PaddleOCR.git
```
b. Goto Dockerfile directory(ps:Need to distinguish between cpu and gpu version, the following takes cpu as an example, gpu version needs to replace the keyword)
```
cd docker/cpu
cd d
eploy/d
ocker/cpu
```
c. Build image
```
...
...
docker/hubserving/README_cn.md
→
d
eploy/d
ocker/hubserving/README_cn.md
浏览文件 @
5d248b16
...
...
@@ -20,7 +20,7 @@ git clone https://github.com/PaddlePaddle/PaddleOCR.git
```
b.切换至Dockerfile目录(注:需要区分cpu或gpu版本,下文以cpu为例,gpu版本需要替换一下关键字即可)
```
cd docker/cpu
cd d
eploy/d
ocker/cpu
```
c.生成镜像
```
...
...
docker/hubserving/cpu/Dockerfile
→
d
eploy/d
ocker/hubserving/cpu/Dockerfile
浏览文件 @
5d248b16
文件已移动
docker/hubserving/gpu/Dockerfile
→
d
eploy/d
ocker/hubserving/gpu/Dockerfile
浏览文件 @
5d248b16
文件已移动
docker/hubserving/sample_request.txt
→
d
eploy/d
ocker/hubserving/sample_request.txt
浏览文件 @
5d248b16
文件已移动
ppocr/utils/utility.py
浏览文件 @
5d248b16
...
...
@@ -90,15 +90,3 @@ def check_and_read_gif(img_path):
return
imgvalue
,
True
return
None
,
False
def
create_multi_devices_program
(
program
,
loss_var_name
):
build_strategy
=
fluid
.
BuildStrategy
()
build_strategy
.
memory_optimize
=
False
build_strategy
.
enable_inplace
=
True
exec_strategy
=
fluid
.
ExecutionStrategy
()
exec_strategy
.
num_iteration_per_drop_scope
=
1
compile_program
=
fluid
.
CompiledProgram
(
program
).
with_data_parallel
(
loss_name
=
loss_var_name
,
build_strategy
=
build_strategy
,
exec_strategy
=
exec_strategy
)
return
compile_program
tools/infer/predict_system.py
浏览文件 @
5d248b16
...
...
@@ -133,7 +133,6 @@ def main(args):
image_file_list
=
get_image_file_list
(
args
.
image_dir
)
text_sys
=
TextSystem
(
args
)
is_visualize
=
True
tackle_img_num
=
0
for
image_file
in
image_file_list
:
img
,
flag
=
check_and_read_gif
(
image_file
)
if
not
flag
:
...
...
@@ -142,9 +141,6 @@ def main(args):
logger
.
info
(
"error in loading image:{}"
.
format
(
image_file
))
continue
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
)
elapse
=
time
.
time
()
-
starttime
print
(
"Predict time of %s: %.3fs"
%
(
image_file
,
elapse
))
...
...
tools/infer/utility.py
浏览文件 @
5d248b16
...
...
@@ -112,6 +112,8 @@ def create_predictor(args, mode):
config
.
disable_gpu
()
config
.
set_cpu_math_library_num_threads
(
6
)
if
args
.
enable_mkldnn
:
# cache 10 different shapes for mkldnn to avoid memory leak
config
.
set_mkldnn_cache_capacity
(
10
)
config
.
enable_mkldnn
()
# config.enable_memory_optim()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录