Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
da63ea3f
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
da63ea3f
编写于
7月 10, 2019
作者:
J
Jiaying Zhao
提交者:
zp7
7月 10, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test_super for 360P, 480P, 576P, 720P (#1741)
上级
e00ccef5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
68 addition
and
101 deletion
+68
-101
test/net/test_super.cpp
test/net/test_super.cpp
+68
-101
未找到文件。
test/net/test_super.cpp
浏览文件 @
da63ea3f
...
...
@@ -21,131 +21,98 @@ int main() {
paddle_mobile
::
PaddleMobileConfigInternal
config
;
config
.
load_when_predict
=
true
;
auto
time1
=
paddle_mobile
::
time
();
#ifdef PADDLE_MOBILE_CL
paddle_mobile
::
PaddleMobile
<
paddle_mobile
::
GPU_CL
>
paddle_mobile
(
config
);
paddle_mobile
.
SetCLPath
(
"/data/local/tmp/bin"
);
#else
paddle_mobile
::
PaddleMobile
<
paddle_mobile
::
CPU
>
paddle_mobile
(
config
)
;
paddle_mobile
::
PaddleMobile
<
paddle_mobile
::
CPU
>
paddle_mobile
;
#endif
// paddle_mobile.SetThreadNum(4);
int
max
=
10
;
auto
time1
=
paddle_mobile
::
time
();
auto
isok
=
paddle_mobile
.
Load
(
std
::
string
(
g_super
)
+
"/model"
,
std
::
string
(
g_super
)
+
"/params"
,
true
,
false
,
1
,
false
);
// auto isok = paddle_mobile.Load(std::string(g_mobilenet_mul), true);
if
(
isok
)
{
auto
time2
=
paddle_mobile
::
time
();
std
::
cout
<<
"load cost :"
<<
paddle_mobile
::
time_diff
(
time1
,
time2
)
<<
"ms"
<<
std
::
endl
;
// 300*300
// std::vector<float> input;
// std::vector<int64_t> dims{1, 1, 300, 300};
// GetInput<float>(g_test_image_1x3x224x224, &input, dims);
//
// std::vector<float> vec_result;
// 300 * 300
std
::
vector
<
float
>
input
;
std
::
vector
<
int64_t
>
dims
{
1
,
1
,
300
,
300
};
GetInput
<
float
>
(
g_test_image_1x3x224x224
,
&
input
,
dims
);
paddle_mobile
.
Predict
(
input
,
dims
);
// 640 * 360 (360P)
std
::
vector
<
float
>
input1
;
std
::
vector
<
int64_t
>
dims1
{
1
,
1
,
640
,
360
};
GetInput
<
float
>
(
g_test_image_1x3x224x224
,
&
input1
,
dims1
);
auto
time3
=
paddle_mobile
::
time
();
int
max
=
1
;
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
auto
time1
=
paddle_mobile
::
time
();
paddle_mobile
.
Predict
(
input1
,
dims1
);
auto
time2
=
paddle_mobile
::
time
();
std
::
cout
<<
"640 * 360 predict cost :第"
<<
i
<<
": "
<<
paddle_mobile
::
time_diff
(
time1
,
time2
)
<<
"ms"
<<
std
::
endl
;
}
auto
time4
=
paddle_mobile
::
time
();
std
::
cout
<<
"640 * 360 predict cost :"
<<
paddle_mobile
::
time_diff
(
time3
,
time4
)
/
max
<<
"ms"
<<
std
::
endl
;
// for (int i = 0; i < max; ++i) {
// auto time5 = paddle_mobile::time();
// vec_result = paddle_mobile.Predict(input, dims);
// auto time6 = paddle_mobile::time();
// std::cout << "300 predict cost :第" << i << ": "
// << paddle_mobile::time_diff(time5, time6) << "ms" <<
// std::endl;
// }
// auto time4 = paddle_mobile::time();
//
// std::cout << "300 predict cost :"
// << paddle_mobile::time_diff(time3, time4) / max << "ms"
// << std::endl;
// auto biggest =
// std::max_element(std::begin(vec_result), std::end(vec_result));
// std::cout << "300 Max element is " << *biggest << " at position "
// << std::distance(std::begin(vec_result), biggest) <<
// std::endl;
//
// // 500*500
// std::vector<float> vec_result2;
//
// std::vector<float> input2;
// std::vector<int64_t> dims2{1, 1, 500, 500};
// GetInput<float>(g_test_image_1x3x224x224, &input2, dims2);
//
// time3 = paddle_mobile::time();
// for (int i = 0; i < max; ++i) {
// auto time5 = paddle_mobile::time();
// vec_result2 = paddle_mobile.Predict(input2, dims2);
// auto time6 = paddle_mobile::time();
// std::cout << "500 predict cost :第" << i << ": "
// << paddle_mobile::time_diff(time5, time6) << "ms" <<
// std::endl;
// }
//
// time4 = paddle_mobile::time();
// std::cout << "500 predict cost :"
// << paddle_mobile::time_diff(time3, time4) / max << "ms"
// << std::endl;
// biggest = std::max_element(std::begin(vec_result2),
// std::end(vec_result2)); std::cout << "500 Max element is " << *biggest
// << " at position "
// << std::distance(std::begin(vec_result2), biggest) <<
// std::endl;
//
// // 1000*1000
//
// std::vector<float> vec_result3;
// std::vector<float> input3;
// std::vector<int64_t> dims3{1, 1, 1000, 1000};
// GetInput<float>(g_test_image_1x3x224x224, &input3, dims3);
//
// time3 = paddle_mobile::time();
//
// for (int i = 0; i < max; ++i) {
// auto time5 = paddle_mobile::time();
// vec_result3 = paddle_mobile.Predict(input3, dims3);
// auto time6 = paddle_mobile::time();
// std::cout << "1000*1000 predict cost :第" << i << ": "
// << paddle_mobile::time_diff(time5, time6) << "ms" <<
// std::endl;
// }
// time4 = paddle_mobile::time();
// std::cout << "1000*1000 predict cost :"
// << paddle_mobile::time_diff(time3, time4) / max << "ms"
// << std::endl;
// biggest = std::max_element(std::begin(vec_result3),
// std::end(vec_result3)); std::cout << "1000*1000 Max element is " <<
// *biggest << " at position "
// << std::distance(std::begin(vec_result3), biggest) <<
// std::endl;
// 720 * 480 (480P)
std
::
vector
<
float
>
input2
;
std
::
vector
<
int64_t
>
dims2
{
1
,
1
,
720
,
480
};
GetInput
<
float
>
(
g_test_image_1x3x224x224
,
&
input2
,
dims2
);
auto
time5
=
paddle_mobile
::
time
();
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
auto
time1
=
paddle_mobile
::
time
();
paddle_mobile
.
Predict
(
input2
,
dims2
);
auto
time2
=
paddle_mobile
::
time
();
std
::
cout
<<
"720 * 480 predict cost :第"
<<
i
<<
": "
<<
paddle_mobile
::
time_diff
(
time1
,
time2
)
<<
"ms"
<<
std
::
endl
;
}
auto
time6
=
paddle_mobile
::
time
();
std
::
cout
<<
"720 * 480 predict cost :"
<<
paddle_mobile
::
time_diff
(
time5
,
time6
)
/
max
<<
"ms"
<<
std
::
endl
;
// 1024 * 576 (576P)
std
::
vector
<
float
>
input3
;
std
::
vector
<
int64_t
>
dims3
{
1
,
1
,
1024
,
576
};
GetInput
<
float
>
(
g_test_image_1x3x224x224
,
&
input3
,
dims3
);
auto
time7
=
paddle_mobile
::
time
();
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
auto
time1
=
paddle_mobile
::
time
();
paddle_mobile
.
Predict
(
input3
,
dims3
);
auto
time2
=
paddle_mobile
::
time
();
std
::
cout
<<
"1024 * 576 predict cost :第"
<<
i
<<
": "
<<
paddle_mobile
::
time_diff
(
time1
,
time2
)
<<
"ms"
<<
std
::
endl
;
}
auto
time8
=
paddle_mobile
::
time
();
std
::
cout
<<
"1024 * 576 predict cost :"
<<
paddle_mobile
::
time_diff
(
time7
,
time8
)
/
max
<<
"ms"
<<
std
::
endl
;
// 224*224
std
::
vector
<
float
>
vec_result4
;
// 1280 * 720
std
::
vector
<
float
>
input4
;
std
::
vector
<
int64_t
>
dims4
{
1
,
1
,
300
,
30
0
};
std
::
vector
<
int64_t
>
dims4
{
1
,
1
,
1280
,
72
0
};
GetInput
<
float
>
(
g_test_image_1x3x224x224
,
&
input4
,
dims4
);
time3
=
paddle_mobile
::
time
();
auto
time9
=
paddle_mobile
::
time
();
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
auto
time
5
=
paddle_mobile
::
time
();
vec_result4
=
paddle_mobile
.
Predict
(
input4
,
dims4
);
auto
time
6
=
paddle_mobile
::
time
();
std
::
cout
<<
"
300*30
0 predict cost :第"
<<
i
<<
": "
<<
paddle_mobile
::
time_diff
(
time
5
,
time6
)
<<
"ms"
<<
std
::
endl
;
auto
time
1
=
paddle_mobile
::
time
();
paddle_mobile
.
Predict
(
input4
,
dims4
);
auto
time
2
=
paddle_mobile
::
time
();
std
::
cout
<<
"
1280 * 72
0 predict cost :第"
<<
i
<<
": "
<<
paddle_mobile
::
time_diff
(
time
1
,
time2
)
<<
"ms"
<<
std
::
endl
;
}
auto
time4
=
paddle_mobile
::
time
();
std
::
cout
<<
"300*300 predict cost :"
<<
paddle_mobile
::
time_diff
(
time3
,
time4
)
/
max
<<
"ms"
auto
time10
=
paddle_mobile
::
time
();
std
::
cout
<<
"1280 * 720 predict cost :"
<<
paddle_mobile
::
time_diff
(
time9
,
time10
)
/
max
<<
"ms"
<<
std
::
endl
;
// biggest = std::max_element(std::begin(vec_result4),
// std::end(vec_result4)); std::cout << "224*224 Max element is " <<
// *biggest << " at position "
// << std::distance(std::begin(vec_result4), biggest) <<
// std::endl;
}
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录