Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
202fa428
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
大约 1 年 前同步成功
通知
1528
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看板
提交
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,6 +75,16 @@ int main(int argc, char **argv) {
...
@@ -75,6 +75,16 @@ int main(int argc, char **argv) {
ocr
.
ocr
(
cv_all_img_names
,
FLAGS_det
,
FLAGS_rec
,
FLAGS_cls
);
ocr
.
ocr
(
cv_all_img_names
,
FLAGS_det
,
FLAGS_rec
,
FLAGS_cls
);
for
(
int
i
=
0
;
i
<
cv_all_img_names
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
cv_all_img_names
.
size
();
++
i
)
{
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
]
<<
' '
;
}
}
cout
<<
endl
;
}
else
{
cout
<<
cv_all_img_names
[
i
]
<<
"
\n
"
;
cout
<<
cv_all_img_names
[
i
]
<<
"
\n
"
;
Utility
::
print_result
(
ocr_results
[
i
]);
Utility
::
print_result
(
ocr_results
[
i
]);
if
(
FLAGS_visualize
&&
FLAGS_det
)
{
if
(
FLAGS_visualize
&&
FLAGS_det
)
{
...
@@ -91,4 +101,5 @@ int main(int argc, char **argv) {
...
@@ -91,4 +101,5 @@ int main(int argc, char **argv) {
}
}
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,
...
@@ -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
)
{
for
(
int
i
=
0
;
i
<
cv_all_img_names
.
size
();
++
i
)
{
std
::
vector
<
OCRPredictResult
>
ocr_result
;
std
::
vector
<
OCRPredictResult
>
ocr_result
;
if
(
!
FLAGS_benchmark
)
{
cout
<<
"predict img: "
<<
cv_all_img_names
[
i
]
<<
endl
;
cout
<<
"predict img: "
<<
cv_all_img_names
[
i
]
<<
endl
;
}
cv
::
Mat
srcimg
=
cv
::
imread
(
cv_all_img_names
[
i
],
cv
::
IMREAD_COLOR
);
cv
::
Mat
srcimg
=
cv
::
imread
(
cv_all_img_names
[
i
],
cv
::
IMREAD_COLOR
);
if
(
!
srcimg
.
data
)
{
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
...
@@ -3,8 +3,8 @@ model_name:ocr_det
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
--use_gpu:
True|
False
--use_gpu:False
--enable_mkldnn:True|False
--enable_mkldnn:True|False
--cpu_threads:1|6
--cpu_threads:1|6
--rec_batch_num:1
--rec_batch_num:1
...
@@ -14,3 +14,7 @@ inference:./deploy/cpp_infer/build/ppocr det
...
@@ -14,3 +14,7 @@ inference:./deploy/cpp_infer/build/ppocr det
--image_dir:./inference/ch_det_data_50/all-sum-510/
--image_dir:./inference/ch_det_data_50/all-sum-510/
null:null
null:null
--benchmark:True
--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 @@
...
@@ -2,7 +2,7 @@
source
test_tipc/common_func.sh
source
test_tipc/common_func.sh
FILENAME
=
$1
FILENAME
=
$1
dataline
=
$(
awk
'NR==1, NR==
16
{print}'
$FILENAME
)
dataline
=
$(
awk
'NR==1, NR==
20
{print}'
$FILENAME
)
# parser params
# parser params
IFS
=
$'
\n
'
IFS
=
$'
\n
'
...
@@ -34,6 +34,14 @@ cpp_infer_key1=$(func_parser_key "${lines[14]}")
...
@@ -34,6 +34,14 @@ cpp_infer_key1=$(func_parser_key "${lines[14]}")
cpp_infer_value1
=
$(
func_parser_value
"
${
lines
[14]
}
"
)
cpp_infer_value1
=
$(
func_parser_value
"
${
lines
[14]
}
"
)
cpp_benchmark_key
=
$(
func_parser_key
"
${
lines
[15]
}
"
)
cpp_benchmark_key
=
$(
func_parser_key
"
${
lines
[15]
}
"
)
cpp_benchmark_value
=
$(
func_parser_value
"
${
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"
LOG_PATH
=
"./test_tipc/output"
mkdir
-p
${
LOG_PATH
}
mkdir
-p
${
LOG_PATH
}
...
@@ -68,7 +76,11 @@ function func_cpp_inference(){
...
@@ -68,7 +76,11 @@ function func_cpp_inference(){
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
}
"
)
set_infer_params1
=
$(
func_set_params
"
${
cpp_infer_key1
}
"
"
${
cpp_infer_value1
}
"
)
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
eval
$command
last_status
=
${
PIPESTATUS
[0]
}
last_status
=
${
PIPESTATUS
[0]
}
eval
"cat
${
_save_log_path
}
"
eval
"cat
${
_save_log_path
}
"
...
@@ -97,7 +109,11 @@ function func_cpp_inference(){
...
@@ -97,7 +109,11 @@ function func_cpp_inference(){
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
}
"
)
set_infer_params1
=
$(
func_set_params
"
${
cpp_infer_key1
}
"
"
${
cpp_infer_value1
}
"
)
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
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录