Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
202fa428
P
PaddleOCR
项目概览
s920243400
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
202fa428
编写于
4月 11, 2022
作者:
文幕地方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adatator tipc
上级
41c60254
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
52 addition
and
19 deletion
+52
-19
deploy/cpp_infer/src/main.cpp
deploy/cpp_infer/src/main.cpp
+23
-12
deploy/cpp_infer/src/paddleocr.cpp
deploy/cpp_infer/src/paddleocr.cpp
+3
-1
test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_infer_cpp_linux_gpu_cpu.txt
...model_linux_gpu_normal_normal_infer_cpp_linux_gpu_cpu.txt
+7
-3
test_tipc/test_inference_cpp.sh
test_tipc/test_inference_cpp.sh
+19
-3
未找到文件。
deploy/cpp_infer/src/main.cpp
浏览文件 @
202fa428
...
...
@@ -75,20 +75,31 @@ int main(int argc, char **argv) {
ocr
.
ocr
(
cv_all_img_names
,
FLAGS_det
,
FLAGS_rec
,
FLAGS_cls
);
for
(
int
i
=
0
;
i
<
cv_all_img_names
.
size
();
++
i
)
{
cout
<<
cv_all_img_names
[
i
]
<<
"
\n
"
;
Utility
::
print_result
(
ocr_results
[
i
]);
if
(
FLAGS_visualize
&&
FLAGS_det
)
{
cv
::
Mat
srcimg
=
cv
::
imread
(
cv_all_img_names
[
i
],
cv
::
IMREAD_COLOR
);
if
(
!
srcimg
.
data
)
{
std
::
cerr
<<
"[ERROR] image read failed! image path: "
<<
cv_all_img_names
[
i
]
<<
endl
;
exit
(
1
);
if
(
FLAGS_benchmark
)
{
cout
<<
cv_all_img_names
[
i
]
<<
'\t'
;
for
(
int
n
=
0
;
n
<
ocr_results
[
i
].
size
();
n
++
)
{
for
(
int
m
=
0
;
m
<
ocr_results
[
i
][
n
].
box
.
size
();
m
++
)
{
cout
<<
ocr_results
[
i
][
n
].
box
[
m
][
0
]
<<
' '
<<
ocr_results
[
i
][
n
].
box
[
m
][
1
]
<<
' '
;
}
}
std
::
string
file_name
=
Utility
::
basename
(
cv_all_img_names
[
i
]);
cout
<<
endl
;
}
else
{
cout
<<
cv_all_img_names
[
i
]
<<
"
\n
"
;
Utility
::
print_result
(
ocr_results
[
i
]);
if
(
FLAGS_visualize
&&
FLAGS_det
)
{
cv
::
Mat
srcimg
=
cv
::
imread
(
cv_all_img_names
[
i
],
cv
::
IMREAD_COLOR
);
if
(
!
srcimg
.
data
)
{
std
::
cerr
<<
"[ERROR] image read failed! image path: "
<<
cv_all_img_names
[
i
]
<<
endl
;
exit
(
1
);
}
std
::
string
file_name
=
Utility
::
basename
(
cv_all_img_names
[
i
]);
Utility
::
VisualizeBboxes
(
srcimg
,
ocr_results
[
i
],
FLAGS_output
+
"/"
+
file_name
);
Utility
::
VisualizeBboxes
(
srcimg
,
ocr_results
[
i
],
FLAGS_output
+
"/"
+
file_name
);
}
cout
<<
"***************************"
<<
endl
;
}
cout
<<
"***************************"
<<
endl
;
}
}
deploy/cpp_infer/src/paddleocr.cpp
浏览文件 @
202fa428
...
...
@@ -144,7 +144,9 @@ PaddleOCR::ocr(std::vector<cv::String> cv_all_img_names, bool det, bool rec,
for
(
int
i
=
0
;
i
<
cv_all_img_names
.
size
();
++
i
)
{
std
::
vector
<
OCRPredictResult
>
ocr_result
;
cout
<<
"predict img: "
<<
cv_all_img_names
[
i
]
<<
endl
;
if
(
!
FLAGS_benchmark
)
{
cout
<<
"predict img: "
<<
cv_all_img_names
[
i
]
<<
endl
;
}
cv
::
Mat
srcimg
=
cv
::
imread
(
cv_all_img_names
[
i
],
cv
::
IMREAD_COLOR
);
if
(
!
srcimg
.
data
)
{
...
...
test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_infer_cpp_linux_gpu_cpu.txt
浏览文件 @
202fa428
...
...
@@ -3,8 +3,8 @@ model_name:ocr_det
use_opencv:True
infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/
infer_quant:False
inference:./deploy/cpp_infer/build/ppocr
det
--use_gpu:
True|
False
inference:./deploy/cpp_infer/build/ppocr
--use_gpu:False
--enable_mkldnn:True|False
--cpu_threads:1|6
--rec_batch_num:1
...
...
@@ -13,4 +13,8 @@ inference:./deploy/cpp_infer/build/ppocr det
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
null:null
--benchmark:True
\ No newline at end of file
--benchmark:True
--det:True
--rec:False
--cls:False
--use_angle_cls:False
\ No newline at end of file
test_tipc/test_inference_cpp.sh
浏览文件 @
202fa428
...
...
@@ -2,7 +2,7 @@
source
test_tipc/common_func.sh
FILENAME
=
$1
dataline
=
$(
awk
'NR==1, NR==
16
{print}'
$FILENAME
)
dataline
=
$(
awk
'NR==1, NR==
20
{print}'
$FILENAME
)
# parser params
IFS
=
$'
\n
'
...
...
@@ -34,6 +34,14 @@ cpp_infer_key1=$(func_parser_key "${lines[14]}")
cpp_infer_value1
=
$(
func_parser_value
"
${
lines
[14]
}
"
)
cpp_benchmark_key
=
$(
func_parser_key
"
${
lines
[15]
}
"
)
cpp_benchmark_value
=
$(
func_parser_value
"
${
lines
[15]
}
"
)
cpp_det_key
=
$(
func_parser_key
"
${
lines
[16]
}
"
)
cpp_det_value
=
$(
func_parser_value
"
${
lines
[16]
}
"
)
cpp_rec_key
=
$(
func_parser_key
"
${
lines
[17]
}
"
)
cpp_rec_value
=
$(
func_parser_value
"
${
lines
[17]
}
"
)
cpp_cls_key
=
$(
func_parser_key
"
${
lines
[18]
}
"
)
cpp_cls_value
=
$(
func_parser_value
"
${
lines
[18]
}
"
)
cpp_use_angle_cls_key
=
$(
func_parser_key
"
${
lines
[19]
}
"
)
cpp_use_angle_cls_value
=
$(
func_parser_value
"
${
lines
[19]
}
"
)
LOG_PATH
=
"./test_tipc/output"
mkdir
-p
${
LOG_PATH
}
...
...
@@ -68,7 +76,11 @@ function func_cpp_inference(){
set_cpu_threads
=
$(
func_set_params
"
${
cpp_cpu_threads_key
}
"
"
${
threads
}
"
)
set_model_dir
=
$(
func_set_params
"
${
cpp_infer_model_key
}
"
"
${
_model_dir
}
"
)
set_infer_params1
=
$(
func_set_params
"
${
cpp_infer_key1
}
"
"
${
cpp_infer_value1
}
"
)
command
=
"
${
_script
}
${
cpp_use_gpu_key
}
=
${
use_gpu
}
${
set_mkldnn
}
${
set_cpu_threads
}
${
set_model_dir
}
${
set_batchsize
}
${
set_infer_data
}
${
set_benchmark
}
${
set_infer_params1
}
>
${
_save_log_path
}
2>&1 "
set_det
=
$(
func_set_params
"
${
cpp_det_key
}
"
"
${
cpp_det_value
}
"
)
set_rec
=
$(
func_set_params
"
${
cpp_rec_key
}
"
"
${
cpp_rec_value
}
"
)
set_cls
=
$(
func_set_params
"
${
cpp_cls_key
}
"
"
${
cpp_cls_value
}
"
)
set_use_angle_cls
=
$(
func_set_params
"
${
cpp_use_angle_cls_key
}
"
"
${
cpp_use_angle_cls_value
}
"
)
command
=
"
${
_script
}
${
cpp_use_gpu_key
}
=
${
use_gpu
}
${
set_mkldnn
}
${
set_cpu_threads
}
${
set_model_dir
}
${
set_batchsize
}
${
set_infer_data
}
${
set_benchmark
}
${
set_det
}
${
set_rec
}
${
set_cls
}
${
set_use_angle_cls
}
${
set_infer_params1
}
>
${
_save_log_path
}
2>&1 "
eval
$command
last_status
=
${
PIPESTATUS
[0]
}
eval
"cat
${
_save_log_path
}
"
...
...
@@ -97,7 +109,11 @@ function func_cpp_inference(){
set_precision
=
$(
func_set_params
"
${
cpp_precision_key
}
"
"
${
precision
}
"
)
set_model_dir
=
$(
func_set_params
"
${
cpp_infer_model_key
}
"
"
${
_model_dir
}
"
)
set_infer_params1
=
$(
func_set_params
"
${
cpp_infer_key1
}
"
"
${
cpp_infer_value1
}
"
)
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 "
set_det
=
$(
func_set_params
"
${
cpp_det_key
}
"
"
${
cpp_det_value
}
"
)
set_rec
=
$(
func_set_params
"
${
cpp_rec_key
}
"
"
${
cpp_rec_value
}
"
)
set_cls
=
$(
func_set_params
"
${
cpp_cls_key
}
"
"
${
cpp_cls_value
}
"
)
set_use_angle_cls
=
$(
func_set_params
"
${
cpp_use_angle_cls_key
}
"
"
${
cpp_use_angle_cls_value
}
"
)
command
=
"
${
_script
}
${
cpp_use_gpu_key
}
=
${
use_gpu
}
${
set_tensorrt
}
${
set_precision
}
${
set_model_dir
}
${
set_batchsize
}
${
set_infer_data
}
${
set_benchmark
}
${
set_det
}
${
set_rec
}
${
set_cls
}
${
set_use_angle_cls
}
${
set_infer_params1
}
>
${
_save_log_path
}
2>&1 "
eval
$command
last_status
=
${
PIPESTATUS
[0]
}
eval
"cat
${
_save_log_path
}
"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录