Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
611df3b6
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
接近 2 年 前同步成功
通知
1549
Star
32964
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看板
提交
611df3b6
编写于
9月 08, 2021
作者:
M
MissPenguin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
surpport ocr_system for cpp cice
上级
b9c73d9a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
7 deletion
+11
-7
deploy/cpp_infer/src/main.cpp
deploy/cpp_infer/src/main.cpp
+2
-1
tests/ocr_det_params.txt
tests/ocr_det_params.txt
+1
-1
tests/ocr_ppocr_mobile_params.txt
tests/ocr_ppocr_mobile_params.txt
+2
-2
tests/test.sh
tests/test.sh
+6
-3
未找到文件。
deploy/cpp_infer/src/main.cpp
浏览文件 @
611df3b6
...
@@ -63,6 +63,7 @@ DEFINE_double(cls_thresh, 0.9, "Threshold of cls_thresh.");
...
@@ -63,6 +63,7 @@ DEFINE_double(cls_thresh, 0.9, "Threshold of cls_thresh.");
DEFINE_string
(
rec_model_dir
,
""
,
"Path of rec inference model."
);
DEFINE_string
(
rec_model_dir
,
""
,
"Path of rec inference model."
);
DEFINE_int32
(
rec_batch_num
,
1
,
"rec_batch_num."
);
DEFINE_int32
(
rec_batch_num
,
1
,
"rec_batch_num."
);
DEFINE_string
(
char_list_file
,
"../../ppocr/utils/ppocr_keys_v1.txt"
,
"Path of dictionary."
);
DEFINE_string
(
char_list_file
,
"../../ppocr/utils/ppocr_keys_v1.txt"
,
"Path of dictionary."
);
// DEFINE_string(char_list_file, "./ppocr/utils/ppocr_keys_v1.txt", "Path of dictionary.");
using
namespace
std
;
using
namespace
std
;
...
@@ -193,7 +194,7 @@ int main_system(std::vector<cv::String> cv_all_img_names) {
...
@@ -193,7 +194,7 @@ int main_system(std::vector<cv::String> cv_all_img_names) {
for
(
int
i
=
0
;
i
<
cv_all_img_names
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
cv_all_img_names
.
size
();
++
i
)
{
LOG
(
INFO
)
<<
"The predict img: "
<<
cv_all_img_names
[
i
];
LOG
(
INFO
)
<<
"The predict img: "
<<
cv_all_img_names
[
i
];
cv
::
Mat
srcimg
=
cv
::
imread
(
FLAGS_image_dir
,
cv
::
IMREAD_COLOR
);
cv
::
Mat
srcimg
=
cv
::
imread
(
cv_all_img_names
[
i
]
,
cv
::
IMREAD_COLOR
);
if
(
!
srcimg
.
data
)
{
if
(
!
srcimg
.
data
)
{
std
::
cerr
<<
"[ERROR] image read failed! image path: "
<<
cv_all_img_names
[
i
]
<<
endl
;
std
::
cerr
<<
"[ERROR] image read failed! image path: "
<<
cv_all_img_names
[
i
]
<<
endl
;
exit
(
1
);
exit
(
1
);
...
...
tests/ocr_det_params.txt
浏览文件 @
611df3b6
...
@@ -62,7 +62,7 @@ inference:./deploy/cpp_infer/build/ppocr det
...
@@ -62,7 +62,7 @@ inference:./deploy/cpp_infer/build/ppocr det
--precision:fp32|fp16
--precision:fp32|fp16
--det_model_dir:
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
--image_dir:./inference/ch_det_data_50/all-sum-510/
--save_log_path
:null
null
:null
--benchmark:True
--benchmark:True
===========================serving_params===========================
===========================serving_params===========================
trans_model:-m paddle_serving_client.convert
trans_model:-m paddle_serving_client.convert
...
...
tests/ocr_ppocr_mobile_params.txt
浏览文件 @
611df3b6
...
@@ -53,7 +53,7 @@ inference:tools/infer/predict_system.py
...
@@ -53,7 +53,7 @@ inference:tools/infer/predict_system.py
use_opencv:True
use_opencv:True
infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/
infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/
infer_quant:False
infer_quant:False
inference:./deploy/cpp_infer/build/ppocr
det
inference:./deploy/cpp_infer/build/ppocr
system
--use_gpu:True|False
--use_gpu:True|False
--enable_mkldnn:True|False
--enable_mkldnn:True|False
--cpu_threads:1|6
--cpu_threads:1|6
...
@@ -62,6 +62,6 @@ inference:./deploy/cpp_infer/build/ppocr det
...
@@ -62,6 +62,6 @@ inference:./deploy/cpp_infer/build/ppocr det
--precision:fp32|fp16
--precision:fp32|fp16
--det_model_dir:
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
--image_dir:./inference/ch_det_data_50/all-sum-510/
--
save_log_path:null
--
rec_model_dir:./inference/ch_ppocr_mobile_v2.0_rec_infer/
--benchmark:True
--benchmark:True
tests/test.sh
浏览文件 @
611df3b6
...
@@ -192,7 +192,8 @@ if [ ${MODE} = "cpp_infer" ]; then
...
@@ -192,7 +192,8 @@ if [ ${MODE} = "cpp_infer" ]; then
cpp_infer_model_key
=
$(
func_parser_key
"
${
lines
[62]
}
"
)
cpp_infer_model_key
=
$(
func_parser_key
"
${
lines
[62]
}
"
)
cpp_image_dir_key
=
$(
func_parser_key
"
${
lines
[63]
}
"
)
cpp_image_dir_key
=
$(
func_parser_key
"
${
lines
[63]
}
"
)
cpp_infer_img_dir
=
$(
func_parser_value
"
${
lines
[63]
}
"
)
cpp_infer_img_dir
=
$(
func_parser_value
"
${
lines
[63]
}
"
)
cpp_save_log_key
=
$(
func_parser_key
"
${
lines
[64]
}
"
)
cpp_rec_model_key
=
$(
func_parser_key
"
${
lines
[64]
}
"
)
cpp_rec_model_value
=
$(
func_parser_value
"
${
lines
[64]
}
"
)
cpp_benchmark_key
=
$(
func_parser_key
"
${
lines
[65]
}
"
)
cpp_benchmark_key
=
$(
func_parser_key
"
${
lines
[65]
}
"
)
cpp_benchmark_value
=
$(
func_parser_value
"
${
lines
[65]
}
"
)
cpp_benchmark_value
=
$(
func_parser_value
"
${
lines
[65]
}
"
)
fi
fi
...
@@ -368,7 +369,8 @@ function func_cpp_inference(){
...
@@ -368,7 +369,8 @@ function func_cpp_inference(){
set_batchsize
=
$(
func_set_params
"
${
cpp_batch_size_key
}
"
"
${
batch_size
}
"
)
set_batchsize
=
$(
func_set_params
"
${
cpp_batch_size_key
}
"
"
${
batch_size
}
"
)
set_cpu_threads
=
$(
func_set_params
"
${
cpp_cpu_threads_key
}
"
"
${
threads
}
"
)
set_cpu_threads
=
$(
func_set_params
"
${
cpp_cpu_threads_key
}
"
"
${
threads
}
"
)
set_model_dir
=
$(
func_set_params
"
${
cpp_infer_model_key
}
"
"
${
_model_dir
}
"
)
set_model_dir
=
$(
func_set_params
"
${
cpp_infer_model_key
}
"
"
${
_model_dir
}
"
)
command
=
"
${
_script
}
${
cpp_use_gpu_key
}
=
${
use_gpu
}
${
cpp_use_mkldnn_key
}
=
${
use_mkldnn
}
${
set_cpu_threads
}
${
set_model_dir
}
${
set_batchsize
}
${
set_infer_data
}
${
set_benchmark
}
>
${
_save_log_path
}
2>&1 "
set_infer_params1
=
$(
func_set_params
"
${
cpp_rec_model_key
}
"
"
${
cpp_rec_model_value
}
"
)
command
=
"
${
_script
}
${
cpp_use_gpu_key
}
=
${
use_gpu
}
${
cpp_use_mkldnn_key
}
=
${
use_mkldnn
}
${
set_cpu_threads
}
${
set_model_dir
}
${
set_batchsize
}
${
set_infer_data
}
${
set_benchmark
}
${
set_infer_params1
}
>
${
_save_log_path
}
2>&1 "
eval
$command
eval
$command
last_status
=
${
PIPESTATUS
[0]
}
last_status
=
${
PIPESTATUS
[0]
}
eval
"cat
${
_save_log_path
}
"
eval
"cat
${
_save_log_path
}
"
...
@@ -396,7 +398,8 @@ function func_cpp_inference(){
...
@@ -396,7 +398,8 @@ function func_cpp_inference(){
set_tensorrt
=
$(
func_set_params
"
${
cpp_use_trt_key
}
"
"
${
use_trt
}
"
)
set_tensorrt
=
$(
func_set_params
"
${
cpp_use_trt_key
}
"
"
${
use_trt
}
"
)
set_precision
=
$(
func_set_params
"
${
cpp_precision_key
}
"
"
${
precision
}
"
)
set_precision
=
$(
func_set_params
"
${
cpp_precision_key
}
"
"
${
precision
}
"
)
set_model_dir
=
$(
func_set_params
"
${
cpp_infer_model_key
}
"
"
${
_model_dir
}
"
)
set_model_dir
=
$(
func_set_params
"
${
cpp_infer_model_key
}
"
"
${
_model_dir
}
"
)
command
=
"
${
_script
}
${
cpp_use_gpu_key
}
=
${
use_gpu
}
${
set_tensorrt
}
${
set_precision
}
${
set_model_dir
}
${
set_batchsize
}
${
set_infer_data
}
${
set_benchmark
}
>
${
_save_log_path
}
2>&1 "
set_infer_params1
=
$(
func_set_params
"
${
cpp_rec_model_key
}
"
"
${
cpp_rec_model_value
}
"
)
command
=
"
${
_script
}
${
cpp_use_gpu_key
}
=
${
use_gpu
}
${
set_tensorrt
}
${
set_precision
}
${
set_model_dir
}
${
set_batchsize
}
${
set_infer_data
}
${
set_benchmark
}
${
set_infer_params1
}
>
${
_save_log_path
}
2>&1 "
eval
$command
eval
$command
last_status
=
${
PIPESTATUS
[0]
}
last_status
=
${
PIPESTATUS
[0]
}
eval
"cat
${
_save_log_path
}
"
eval
"cat
${
_save_log_path
}
"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录