Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
df98ac61
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
接近 2 年 前同步成功
通知
707
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
df98ac61
编写于
10月 28, 2021
作者:
Z
zhiboniu
提交者:
GitHub
10月 28, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update BenchmarkLog and fix some bug (#4383)
上级
97373901
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
49 addition
and
19 deletion
+49
-19
deploy/cpp/src/main_keypoint.cc
deploy/cpp/src/main_keypoint.cc
+22
-5
deploy/lite/README.md
deploy/lite/README.md
+1
-1
deploy/lite/src/main.cc
deploy/lite/src/main.cc
+26
-13
未找到文件。
deploy/cpp/src/main_keypoint.cc
浏览文件 @
df98ac61
...
@@ -79,17 +79,32 @@ void PrintBenchmarkLog(std::vector<double> det_time, int img_num){
...
@@ -79,17 +79,32 @@ void PrintBenchmarkLog(std::vector<double> det_time, int img_num){
LOG
(
INFO
)
<<
"cpu_math_library_num_threads: "
<<
FLAGS_cpu_threads
;
LOG
(
INFO
)
<<
"cpu_math_library_num_threads: "
<<
FLAGS_cpu_threads
;
LOG
(
INFO
)
<<
"----------------------- Data info -----------------------"
;
LOG
(
INFO
)
<<
"----------------------- Data info -----------------------"
;
LOG
(
INFO
)
<<
"batch_size: "
<<
FLAGS_batch_size
;
LOG
(
INFO
)
<<
"batch_size: "
<<
FLAGS_batch_size
;
LOG
(
INFO
)
<<
"batch_size_keypoint: "
<<
FLAGS_batch_size_keypoint
;
LOG
(
INFO
)
<<
"input_shape: "
<<
"dynamic shape"
;
LOG
(
INFO
)
<<
"input_shape: "
<<
"dynamic shape"
;
LOG
(
INFO
)
<<
"----------------------- Model info -----------------------"
;
LOG
(
INFO
)
<<
"----------------------- Model info -----------------------"
;
FLAGS_model_dir
.
erase
(
FLAGS_model_dir
.
find_last_not_of
(
"/"
)
+
1
);
FLAGS_model_dir
.
erase
(
FLAGS_model_dir
.
find_last_not_of
(
"/"
)
+
1
);
LOG
(
INFO
)
<<
"model_name: "
<<
FLAGS_model_dir
.
substr
(
FLAGS_model_dir
.
find_last_of
(
'/'
)
+
1
);
LOG
(
INFO
)
<<
"model_name: "
<<
FLAGS_model_dir
;
LOG
(
INFO
)
<<
"----------------------- Perf info ------------------------"
;
LOG
(
INFO
)
<<
"Total number of predicted data: "
<<
img_num
<<
" and total time spent(ms): "
<<
std
::
accumulate
(
det_time
.
begin
(),
det_time
.
end
(),
0.
);
img_num
=
std
::
max
(
1
,
img_num
);
LOG
(
INFO
)
<<
"preproce_time(ms): "
<<
det_time
[
0
]
/
img_num
<<
", inference_time(ms): "
<<
det_time
[
1
]
/
img_num
<<
", postprocess_time(ms): "
<<
det_time
[
2
]
/
img_num
;
}
void
PrintKptsBenchmarkLog
(
std
::
vector
<
double
>
det_time
,
int
img_num
){
LOG
(
INFO
)
<<
"----------------------- Data info -----------------------"
;
LOG
(
INFO
)
<<
"batch_size_keypoint: "
<<
FLAGS_batch_size_keypoint
;
LOG
(
INFO
)
<<
"----------------------- Model info -----------------------"
;
FLAGS_model_dir_keypoint
.
erase
(
FLAGS_model_dir_keypoint
.
find_last_not_of
(
"/"
)
+
1
);
FLAGS_model_dir_keypoint
.
erase
(
FLAGS_model_dir_keypoint
.
find_last_not_of
(
"/"
)
+
1
);
LOG
(
INFO
)
<<
"
model_name: "
<<
FLAGS_model_dir_keypoint
.
substr
(
FLAGS_model_dir_keypoint
.
find_last_of
(
'/'
)
+
1
)
;
LOG
(
INFO
)
<<
"
keypoint_model_name: "
<<
FLAGS_model_dir_keypoint
;
LOG
(
INFO
)
<<
"----------------------- Perf info ------------------------"
;
LOG
(
INFO
)
<<
"----------------------- Perf info ------------------------"
;
LOG
(
INFO
)
<<
"Total number of predicted data: "
<<
img_num
LOG
(
INFO
)
<<
"Total number of predicted data: "
<<
img_num
<<
" and total time spent(ms): "
<<
" and total time spent(ms): "
<<
std
::
accumulate
(
det_time
.
begin
(),
det_time
.
end
(),
0
);
<<
std
::
accumulate
(
det_time
.
begin
(),
det_time
.
end
(),
0.
);
img_num
=
std
::
max
(
1
,
img_num
);
LOG
(
INFO
)
<<
"Average time cost per person:"
;
LOG
(
INFO
)
<<
"preproce_time(ms): "
<<
det_time
[
0
]
/
img_num
LOG
(
INFO
)
<<
"preproce_time(ms): "
<<
det_time
[
0
]
/
img_num
<<
", inference_time(ms): "
<<
det_time
[
1
]
/
img_num
<<
", inference_time(ms): "
<<
det_time
[
1
]
/
img_num
<<
", postprocess_time(ms): "
<<
det_time
[
2
]
/
img_num
;
<<
", postprocess_time(ms): "
<<
det_time
[
2
]
/
img_num
;
...
@@ -424,7 +439,9 @@ void PredictImage(const std::vector<std::string> all_img_paths,
...
@@ -424,7 +439,9 @@ void PredictImage(const std::vector<std::string> all_img_paths,
det_t
[
2
]
+=
det_times
[
2
];
det_t
[
2
]
+=
det_times
[
2
];
}
}
PrintBenchmarkLog
(
det_t
,
all_img_paths
.
size
());
PrintBenchmarkLog
(
det_t
,
all_img_paths
.
size
());
PrintBenchmarkLog
(
keypoint_t
,
kpts_imgs
);
if
(
keypoint
)
{
PrintKptsBenchmarkLog
(
keypoint_t
,
kpts_imgs
);
}
}
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
...
...
deploy/lite/README.md
浏览文件 @
df98ac61
...
@@ -193,7 +193,7 @@ make ARM_ABI = arm8
...
@@ -193,7 +193,7 @@ make ARM_ABI = arm8
5.
准备优化后的模型、预测库文件、测试图像。
5.
准备优化后的模型、预测库文件、测试图像。
```
shell
```
shell
m
dk
ir deploy
m
kd
ir
deploy
cp
main
*
runtime_config.json deploy/
cp
main
*
runtime_config.json deploy/
cd
deploy
cd
deploy
mkdir
model_det
mkdir
model_det
...
...
deploy/lite/src/main.cc
浏览文件 @
df98ac61
...
@@ -39,34 +39,47 @@ void PrintBenchmarkLog(std::vector<double> det_time, int img_num) {
...
@@ -39,34 +39,47 @@ void PrintBenchmarkLog(std::vector<double> det_time, int img_num) {
<<
std
::
endl
;
<<
std
::
endl
;
std
::
cout
<<
"batch_size_det: "
<<
RT_Config
[
"batch_size_det"
].
as
<
int
>
()
std
::
cout
<<
"batch_size_det: "
<<
RT_Config
[
"batch_size_det"
].
as
<
int
>
()
<<
std
::
endl
;
<<
std
::
endl
;
std
::
cout
<<
"batch_size_keypoint: "
<<
RT_Config
[
"batch_size_keypoint"
].
as
<
int
>
()
<<
std
::
endl
;
std
::
cout
<<
"----------------------- Model info -----------------------"
std
::
cout
<<
"----------------------- Model info -----------------------"
<<
std
::
endl
;
<<
std
::
endl
;
RT_Config
[
"model_dir_det"
].
as
<
std
::
string
>
().
erase
(
RT_Config
[
"model_dir_det"
].
as
<
std
::
string
>
().
erase
(
RT_Config
[
"model_dir_det"
].
as
<
std
::
string
>
().
find_last_not_of
(
"/"
)
+
1
);
RT_Config
[
"model_dir_det"
].
as
<
std
::
string
>
().
find_last_not_of
(
"/"
)
+
1
);
std
::
cout
std
::
cout
<<
"detection model_name: "
<<
"detection model_name: "
<<
RT_Config
[
"model_dir_det"
].
as
<
std
::
string
>
().
substr
(
<<
RT_Config
[
"model_dir_det"
].
as
<
std
::
string
>
()
RT_Config
[
"model_dir_det"
].
as
<
std
::
string
>
().
find_last_of
(
'/'
)
+
1
)
<<
std
::
endl
;
<<
std
::
endl
;
std
::
cout
<<
"----------------------- Perf info ------------------------"
<<
std
::
endl
;
std
::
cout
<<
"Total number of predicted data: "
<<
img_num
<<
" and total time spent(ms): "
<<
std
::
accumulate
(
det_time
.
begin
(),
det_time
.
end
(),
0.
)
<<
std
::
endl
;
img_num
=
std
::
max
(
1
,
img_num
);
std
::
cout
<<
"preproce_time(ms): "
<<
det_time
[
0
]
/
img_num
<<
", inference_time(ms): "
<<
det_time
[
1
]
/
img_num
<<
", postprocess_time(ms): "
<<
det_time
[
2
]
/
img_num
<<
std
::
endl
;
}
void
PrintKptsBenchmarkLog
(
std
::
vector
<
double
>
det_time
,
int
img_num
){
std
::
cout
<<
"----------------------- Data info -----------------------"
<<
std
::
endl
;
std
::
cout
<<
"batch_size_keypoint: "
<<
RT_Config
[
"batch_size_keypoint"
].
as
<
int
>
()
<<
std
::
endl
;
std
::
cout
<<
"----------------------- Model info -----------------------"
<<
std
::
endl
;
RT_Config
[
"model_dir_keypoint"
].
as
<
std
::
string
>
().
erase
(
RT_Config
[
"model_dir_keypoint"
].
as
<
std
::
string
>
().
erase
(
RT_Config
[
"model_dir_keypoint"
].
as
<
std
::
string
>
().
find_last_not_of
(
"/"
)
+
RT_Config
[
"model_dir_keypoint"
].
as
<
std
::
string
>
().
find_last_not_of
(
"/"
)
+
1
);
1
);
std
::
cout
std
::
cout
<<
"keypoint model_name: "
<<
"keypoint model_name: "
<<
RT_Config
[
"model_dir_keypoint"
].
as
<
std
::
string
>
().
substr
(
<<
RT_Config
[
"model_dir_keypoint"
].
as
<
std
::
string
>
()
<<
std
::
endl
;
RT_Config
[
"model_dir_keypoint"
].
as
<
std
::
string
>
().
find_last_of
(
'/'
)
+
1
)
<<
std
::
endl
;
std
::
cout
<<
"----------------------- Perf info ------------------------"
std
::
cout
<<
"----------------------- Perf info ------------------------"
<<
std
::
endl
;
<<
std
::
endl
;
std
::
cout
<<
"Total number of predicted data: "
<<
img_num
std
::
cout
<<
"Total number of predicted data: "
<<
img_num
<<
" and total time spent(ms): "
<<
" and total time spent(ms): "
<<
std
::
accumulate
(
det_time
.
begin
(),
det_time
.
end
(),
0
)
<<
std
::
accumulate
(
det_time
.
begin
(),
det_time
.
end
(),
0.
)
<<
std
::
endl
;
<<
std
::
endl
;
img_num
=
std
::
max
(
1
,
img_num
);
std
::
cout
<<
"preproce_time(ms): "
<<
det_time
[
0
]
/
img_num
std
::
cout
<<
"Average time cost per person:"
<<
std
::
endl
<<
"preproce_time(ms): "
<<
det_time
[
0
]
/
img_num
<<
", inference_time(ms): "
<<
det_time
[
1
]
/
img_num
<<
", inference_time(ms): "
<<
det_time
[
1
]
/
img_num
<<
", postprocess_time(ms): "
<<
det_time
[
2
]
/
img_num
<<
std
::
endl
;
<<
", postprocess_time(ms): "
<<
det_time
[
2
]
/
img_num
<<
std
::
endl
;
}
}
...
@@ -284,7 +297,7 @@ void PredictImage(const std::vector<std::string> all_img_paths,
...
@@ -284,7 +297,7 @@ void PredictImage(const std::vector<std::string> all_img_paths,
}
}
PrintBenchmarkLog
(
det_t
,
all_img_paths
.
size
());
PrintBenchmarkLog
(
det_t
,
all_img_paths
.
size
());
if
(
keypoint
)
{
if
(
keypoint
)
{
PrintBenchmarkLog
(
keypoint_t
,
kpts_imgs
);
Print
Kpts
BenchmarkLog
(
keypoint_t
,
kpts_imgs
);
PrintTotalIimeLog
((
det_t
[
0
]
+
det_t
[
1
]
+
det_t
[
2
])
/
all_img_paths
.
size
(),
PrintTotalIimeLog
((
det_t
[
0
]
+
det_t
[
1
]
+
det_t
[
2
])
/
all_img_paths
.
size
(),
(
keypoint_t
[
0
]
+
keypoint_t
[
1
]
+
keypoint_t
[
2
])
/
all_img_paths
.
size
(),
(
keypoint_t
[
0
]
+
keypoint_t
[
1
]
+
keypoint_t
[
2
])
/
all_img_paths
.
size
(),
midtimecost
/
all_img_paths
.
size
());
midtimecost
/
all_img_paths
.
size
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录