Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
680868a9
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
337
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看板
提交
680868a9
编写于
5月 30, 2018
作者:
E
eclipsess
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add test resnet squeezenet ssd(mobilenet)
上级
410e5bdf
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
150 addition
and
14 deletion
+150
-14
src/common/types.h
src/common/types.h
+19
-13
src/io.cpp
src/io.cpp
+1
-1
test/CMakeLists.txt
test/CMakeLists.txt
+11
-0
test/net/test_mobilenet+ssd.cpp
test/net/test_mobilenet+ssd.cpp
+39
-0
test/net/test_resnet.cpp
test/net/test_resnet.cpp
+39
-0
test/net/test_squeezenet.cpp
test/net/test_squeezenet.cpp
+41
-0
未找到文件。
src/common/types.h
浏览文件 @
680868a9
...
@@ -95,17 +95,23 @@ static const std::string G_OP_TYPE_FETCH = "fetch";
...
@@ -95,17 +95,23 @@ static const std::string G_OP_TYPE_FETCH = "fetch";
static
std
::
unordered_map
<
static
std
::
unordered_map
<
std
::
string
,
std
::
pair
<
std
::
vector
<
std
::
string
>
,
std
::
vector
<
std
::
string
>>>
std
::
string
,
std
::
pair
<
std
::
vector
<
std
::
string
>
,
std
::
vector
<
std
::
string
>>>
op_input_output_key
=
{{
G_OP_TYPE_CONV
,
{{
"Input"
},
{
"Output"
}}},
op_input_output_key
=
{
{
G_OP_TYPE_RELU
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_CONV
,
{{
"Input"
},
{
"Output"
}}},
{
G_OP_TYPE_SOFTMAX
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_RELU
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_MUL
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_SOFTMAX
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_ELEMENTWISE_ADD
,
{{
"X"
,
"Y"
},
{
"Out"
}}},
{
G_OP_TYPE_MUL
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_POOL2D
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_ELEMENTWISE_ADD
,
{{
"X"
,
"Y"
},
{
"Out"
}}},
{
G_OP_TYPE_BATCHNORM
,
{{
"X"
},
{
"Y"
}}},
{
G_OP_TYPE_POOL2D
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_LRN
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_BATCHNORM
,
{{
"X"
},
{
"Y"
}}},
{
G_OP_TYPE_CONCAT
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_LRN
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_SPLIT
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_CONCAT
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_FEED
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_SPLIT
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_FETCH
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_FEED
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_RESHAPE
,
{{
"X"
},
{
"Out"
}}}};
{
G_OP_TYPE_FETCH
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_TRANSPOSE
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_BOX_CODER
,
{{
"PriorBox"
,
"PriorBoxVar"
,
"TargetBox"
},
{
"OutputBox"
}}},
{
G_OP_TYPE_PRIOR_BOX
,
{{
"Image"
,
"Input"
},
{
"Boxes"
,
"Variances"
}}},
{
G_OP_TYPE_MULTICLASS_NMS
,
{{
"BBoxes"
,
"Scores"
},
{
"Out"
}}},
{
G_OP_TYPE_RESHAPE
,
{{
"X"
},
{
"Out"
}}}};
}
// namespace paddle_mobile
}
// namespace paddle_mobile
src/io.cpp
浏览文件 @
680868a9
...
@@ -220,7 +220,7 @@ const framework::Program<Dtype, P> Loader<Dtype, P>::Load(
...
@@ -220,7 +220,7 @@ const framework::Program<Dtype, P> Loader<Dtype, P>::Load(
}
}
}
}
}
}
//
originProgramDesc->Description("program: ");
originProgramDesc
->
Description
(
"program: "
);
if
(
optimize
)
{
if
(
optimize
)
{
framework
::
ProgramOptimize
program_optimize
;
framework
::
ProgramOptimize
program_optimize
;
...
...
test/CMakeLists.txt
浏览文件 @
680868a9
...
@@ -96,6 +96,17 @@ target_link_libraries(test-googlenet paddle-mobile)
...
@@ -96,6 +96,17 @@ target_link_libraries(test-googlenet paddle-mobile)
ADD_EXECUTABLE
(
test-mobilenet net/test_mobilenet.cpp test_helper.h test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-mobilenet net/test_mobilenet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-mobilenet paddle-mobile
)
target_link_libraries
(
test-mobilenet paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-resnet net/test_resnet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-resnet paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-mobilenetssd net/test_mobilenet+ssd.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-mobilenetssd paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-squeezenet net/test_squeezenet.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-squeezenet paddle-mobile
)
# gen test
# gen test
ADD_EXECUTABLE
(
test-sigmoid operators/test_sigmoid_op.cpp test_include.h
)
ADD_EXECUTABLE
(
test-sigmoid operators/test_sigmoid_op.cpp test_include.h
)
target_link_libraries
(
test-sigmoid paddle-mobile
)
target_link_libraries
(
test-sigmoid paddle-mobile
)
...
...
test/net/test_mobilenet+ssd.cpp
0 → 100644
浏览文件 @
680868a9
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include <fstream>
#include "../test_helper.h"
#include "../test_include.h"
int
main
()
{
paddle_mobile
::
Loader
<
paddle_mobile
::
CPU
>
loader
;
auto
time1
=
time
();
auto
program
=
loader
.
Load
(
g_mobilenet_ssd
,
false
);
auto
time2
=
time
();
DLOG
<<
"load cost :"
<<
time_diff
(
time1
,
time1
)
<<
"ms"
;
paddle_mobile
::
Executor
<
paddle_mobile
::
CPU
>
executor
(
program
,
1
,
false
);
std
::
vector
<
int64_t
>
dims
{
1
,
3
,
300
,
300
};
Tensor
input_tensor
;
SetupTensor
<
float
>
(
&
input_tensor
,
{
1
,
3
,
300
,
300
},
static_cast
<
float
>
(
0
),
static_cast
<
float
>
(
1
));
std
::
vector
<
float
>
input
(
input_tensor
.
data
<
float
>
(),
input_tensor
.
data
<
float
>
()
+
input_tensor
.
numel
());
auto
time3
=
time
();
executor
.
Predict
(
input
,
dims
);
auto
time4
=
time
();
DLOG
<<
"predict cost :"
<<
time_diff
(
time3
,
time4
)
<<
"ms"
;
return
0
;
}
test/net/test_resnet.cpp
0 → 100644
浏览文件 @
680868a9
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include <fstream>
#include "../test_helper.h"
#include "../test_include.h"
int
main
()
{
paddle_mobile
::
Loader
<
paddle_mobile
::
CPU
>
loader
;
auto
time1
=
time
();
auto
program
=
loader
.
Load
(
g_resnet
,
false
);
auto
time2
=
time
();
DLOG
<<
"load cost :"
<<
time_diff
(
time1
,
time1
)
<<
"ms"
;
paddle_mobile
::
Executor
<
paddle_mobile
::
CPU
>
executor
(
program
,
1
,
false
);
std
::
vector
<
int64_t
>
dims
{
1
,
3
,
32
,
32
};
Tensor
input_tensor
;
SetupTensor
<
float
>
(
&
input_tensor
,
{
1
,
3
,
32
,
32
},
static_cast
<
float
>
(
0
),
static_cast
<
float
>
(
1
));
std
::
vector
<
float
>
input
(
input_tensor
.
data
<
float
>
(),
input_tensor
.
data
<
float
>
()
+
input_tensor
.
numel
());
auto
time3
=
time
();
executor
.
Predict
(
input
,
dims
);
auto
time4
=
time
();
DLOG
<<
"predict cost :"
<<
time_diff
(
time3
,
time4
)
<<
"ms"
;
return
0
;
}
test/net/test_squeezenet.cpp
0 → 100644
浏览文件 @
680868a9
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include <fstream>
#include "../test_helper.h"
#include "../test_include.h"
int
main
()
{
paddle_mobile
::
Loader
<
paddle_mobile
::
CPU
>
loader
;
// ../../../test/models/googlenet
// ../../../test/models/mobilenet
auto
time1
=
time
();
auto
program
=
loader
.
Load
(
g_squeezenet
,
false
);
auto
time2
=
time
();
DLOG
<<
"load cost :"
<<
time_diff
(
time1
,
time1
)
<<
"ms"
;
paddle_mobile
::
Executor
<
paddle_mobile
::
CPU
>
executor
(
program
,
1
,
false
);
std
::
vector
<
int64_t
>
dims
{
1
,
3
,
227
,
227
};
Tensor
input_tensor
;
SetupTensor
<
float
>
(
&
input_tensor
,
{
1
,
3
,
227
,
227
},
static_cast
<
float
>
(
0
),
static_cast
<
float
>
(
1
));
std
::
vector
<
float
>
input
(
input_tensor
.
data
<
float
>
(),
input_tensor
.
data
<
float
>
()
+
input_tensor
.
numel
());
auto
time3
=
time
();
executor
.
Predict
(
input
,
dims
);
auto
time4
=
time
();
DLOG
<<
"predict cost :"
<<
time_diff
(
time3
,
time4
)
<<
"ms"
;
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录