Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
73e33f6a
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看板
提交
73e33f6a
编写于
8月 14, 2018
作者:
xiebaiyuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add mobilenet mulop && add unit test for mobilenet combine closed
#745
上级
0ec3433d
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
65 addition
and
1 deletion
+65
-1
test/CMakeLists.txt
test/CMakeLists.txt
+9
-0
test/net/test_mobilenet.cpp
test/net/test_mobilenet.cpp
+3
-0
test/net/test_mobilenet_combine.cpp
test/net/test_mobilenet_combine.cpp
+51
-0
test/test_helper.h
test/test_helper.h
+1
-0
tools/op.cmake
tools/op.cmake
+1
-1
未找到文件。
test/CMakeLists.txt
浏览文件 @
73e33f6a
...
@@ -9,6 +9,11 @@ elseif ("mobilenet" IN_LIST NET)
...
@@ -9,6 +9,11 @@ elseif ("mobilenet" IN_LIST NET)
# gen test
# gen test
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-mobilenet-combine net/test_mobilenet_combine.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-mobilenet-combine paddle-mobile
)
elseif
(
"yolo"
IN_LIST NET
)
elseif
(
"yolo"
IN_LIST NET
)
# gen test
# gen test
ADD_EXECUTABLE
(
test-yolo net/test_yolo.cpp test_helper.h test_include.h executor_for_test.h
)
ADD_EXECUTABLE
(
test-yolo net/test_yolo.cpp test_helper.h test_include.h executor_for_test.h
)
...
@@ -138,6 +143,10 @@ else ()
...
@@ -138,6 +143,10 @@ else ()
ADD_EXECUTABLE
(
test-mobilenetssd net/test_mobilenet+ssd.cpp test_helper.h test_include.h executor_for_test.h
)
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
)
target_link_libraries
(
test-mobilenetssd paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-mobilenet-combine net/test_mobilenet_combine.cpp test_helper.h test_include.h executor_for_test.h
)
target_link_libraries
(
test-mobilenet-combine 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.cpp
浏览文件 @
73e33f6a
...
@@ -44,5 +44,8 @@ int main() {
...
@@ -44,5 +44,8 @@ int main() {
<<
std
::
endl
;
<<
std
::
endl
;
}
}
std
::
cout
<<
"如果结果Nan请查看: test/images/test_image_1x3x224x224_float 是否存在?"
<<
std
::
endl
;
return
0
;
return
0
;
}
}
test/net/test_mobilenet_combine.cpp
0 → 100644
浏览文件 @
73e33f6a
/* 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 <iostream>
#include "../test_helper.h"
#include "../test_include.h"
int
main
()
{
paddle_mobile
::
PaddleMobile
<
paddle_mobile
::
CPU
>
paddle_mobile
;
paddle_mobile
.
SetThreadNum
(
4
);
auto
time1
=
time
();
if
(
paddle_mobile
.
Load
(
std
::
string
(
g_mobilenet_combined
)
+
"/model"
,
std
::
string
(
g_mobilenet_combined
)
+
"/params"
,
true
))
{
auto
time2
=
time
();
std
::
cout
<<
"load cost :"
<<
time_diff
(
time1
,
time1
)
<<
"ms"
<<
std
::
endl
;
std
::
vector
<
float
>
input
;
std
::
vector
<
int64_t
>
dims
{
1
,
3
,
224
,
224
};
GetInput
<
float
>
(
g_test_image_1x3x224x224_banana
,
&
input
,
dims
);
// 预热一次
auto
vec_result
=
paddle_mobile
.
Predict
(
input
,
dims
);
std
::
vector
<
float
>::
iterator
biggest
=
std
::
max_element
(
std
::
begin
(
vec_result
),
std
::
end
(
vec_result
));
std
::
cout
<<
" Max element is "
<<
*
biggest
<<
" at position "
<<
std
::
distance
(
std
::
begin
(
vec_result
),
biggest
)
<<
std
::
endl
;
auto
time3
=
time
();
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
auto
vec_result
=
paddle_mobile
.
Predict
(
input
,
dims
);
}
auto
time4
=
time
();
std
::
cout
<<
"predict cost :"
<<
time_diff
(
time3
,
time4
)
/
10
<<
"ms"
<<
std
::
endl
;
}
std
::
cout
<<
"如果结果Nan请查看: test/images/test_image_1x3x224x224_float 是否存在?"
<<
std
::
endl
;
return
0
;
}
test/test_helper.h
浏览文件 @
73e33f6a
...
@@ -27,6 +27,7 @@ limitations under the License. */
...
@@ -27,6 +27,7 @@ limitations under the License. */
static
const
char
*
g_ocr
=
"../models/ocr"
;
static
const
char
*
g_ocr
=
"../models/ocr"
;
static
const
char
*
g_mobilenet_ssd
=
"../models/mobilenet+ssd"
;
static
const
char
*
g_mobilenet_ssd
=
"../models/mobilenet+ssd"
;
static
const
char
*
g_mobilenet_ssd_gesture
=
"../models/mobilenet+ssd_gesture"
;
static
const
char
*
g_mobilenet_ssd_gesture
=
"../models/mobilenet+ssd_gesture"
;
static
const
char
*
g_mobilenet_combined
=
"../models/mobilenet_combine"
;
static
const
char
*
g_squeezenet
=
"../models/squeezenet"
;
static
const
char
*
g_squeezenet
=
"../models/squeezenet"
;
static
const
char
*
g_googlenet
=
"../models/googlenet"
;
static
const
char
*
g_googlenet
=
"../models/googlenet"
;
static
const
char
*
g_mobilenet
=
"../models/mobilenet"
;
static
const
char
*
g_mobilenet
=
"../models/mobilenet"
;
...
...
tools/op.cmake
浏览文件 @
73e33f6a
...
@@ -21,7 +21,7 @@ if ("mobilenet" IN_LIST NET)
...
@@ -21,7 +21,7 @@ if ("mobilenet" IN_LIST NET)
set
(
ELEMENTWISEADD_OP ON
)
set
(
ELEMENTWISEADD_OP ON
)
set
(
RELU_OP ON
)
set
(
RELU_OP ON
)
set
(
SOFTMAX_OP ON
)
set
(
SOFTMAX_OP ON
)
set
(
SOFTMAX
_OP ON
)
set
(
MUL
_OP ON
)
set
(
DEPTHWISECONV_OP ON
)
set
(
DEPTHWISECONV_OP ON
)
set
(
BATCHNORM_OP ON
)
set
(
BATCHNORM_OP ON
)
set
(
POOL_OP ON
)
set
(
POOL_OP ON
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录