Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
Mace
提交
6bef90cd
Mace
项目概览
慢慢CG
/
Mace
与 Fork 源项目一致
Fork自
Xiaomi / Mace
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6bef90cd
编写于
2月 27, 2018
作者:
W
wuchenghui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add EMBED_MODE_DATA option
上级
1d884eb9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
2 deletion
+13
-2
mace_run.cc
mace_run.cc
+13
-2
未找到文件。
mace_run.cc
浏览文件 @
6bef90cd
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
* --output_shape=1,224,224,2 \
* --output_shape=1,224,224,2 \
* --input_file=input_data \
* --input_file=input_data \
* --output_file=mace.out \
* --output_file=mace.out \
* --model_data_file=model_data.data \
* --device=OPENCL
* --device=OPENCL
*/
*/
#include <cstdlib>
#include <cstdlib>
...
@@ -31,7 +32,11 @@ using namespace mace;
...
@@ -31,7 +32,11 @@ using namespace mace;
namespace
mace
{
namespace
mace
{
namespace
MACE_MODEL_TAG
{
namespace
MACE_MODEL_TAG
{
extern
NetDef
CreateNet
();
extern
unsigned
char
*
LoadModelData
(
const
char
*
model_data_file
);
extern
void
UnloadModelData
(
unsigned
char
*
model_data
);
extern
NetDef
CreateNet
(
const
unsigned
char
*
model_data
);
extern
const
std
::
string
ModelChecksum
();
extern
const
std
::
string
ModelChecksum
();
...
@@ -133,6 +138,7 @@ DEFINE_string(input_shape, "1,224,224,3", "input shape, separated by comma");
...
@@ -133,6 +138,7 @@ DEFINE_string(input_shape, "1,224,224,3", "input shape, separated by comma");
DEFINE_string
(
output_shape
,
"1,224,224,2"
,
"output shape, separated by comma"
);
DEFINE_string
(
output_shape
,
"1,224,224,2"
,
"output shape, separated by comma"
);
DEFINE_string
(
input_file
,
""
,
"input file name"
);
DEFINE_string
(
input_file
,
""
,
"input file name"
);
DEFINE_string
(
output_file
,
""
,
"output file name"
);
DEFINE_string
(
output_file
,
""
,
"output file name"
);
DEFINE_string
(
model_data_file
,
""
,
"model data file name, used when EMBED_MODEL_DATA set to 0"
);
DEFINE_string
(
device
,
"OPENCL"
,
"CPU/NEON/OPENCL/HEXAGON"
);
DEFINE_string
(
device
,
"OPENCL"
,
"CPU/NEON/OPENCL/HEXAGON"
);
DEFINE_int32
(
round
,
1
,
"round"
);
DEFINE_int32
(
round
,
1
,
"round"
);
DEFINE_int32
(
malloc_check_cycle
,
-
1
,
"malloc debug check cycle, -1 to disable"
);
DEFINE_int32
(
malloc_check_cycle
,
-
1
,
"malloc debug check cycle, -1 to disable"
);
...
@@ -148,6 +154,7 @@ int main(int argc, char **argv) {
...
@@ -148,6 +154,7 @@ int main(int argc, char **argv) {
<<
"output_shape: "
<<
FLAGS_output_shape
<<
std
::
endl
<<
"output_shape: "
<<
FLAGS_output_shape
<<
std
::
endl
<<
"input_file: "
<<
FLAGS_input_file
<<
std
::
endl
<<
"input_file: "
<<
FLAGS_input_file
<<
std
::
endl
<<
"output_file: "
<<
FLAGS_output_file
<<
std
::
endl
<<
"output_file: "
<<
FLAGS_output_file
<<
std
::
endl
<<
"model_data_file: "
<<
FLAGS_model_data_file
<<
std
::
endl
<<
"device: "
<<
FLAGS_device
<<
std
::
endl
<<
"device: "
<<
FLAGS_device
<<
std
::
endl
<<
"round: "
<<
FLAGS_round
<<
std
::
endl
;
<<
"round: "
<<
FLAGS_round
<<
std
::
endl
;
...
@@ -158,7 +165,8 @@ int main(int argc, char **argv) {
...
@@ -158,7 +165,8 @@ int main(int argc, char **argv) {
// load model
// load model
int64_t
t0
=
NowMicros
();
int64_t
t0
=
NowMicros
();
NetDef
net_def
=
mace
::
MACE_MODEL_TAG
::
CreateNet
();
unsigned
char
*
model_data
=
mace
::
MACE_MODEL_TAG
::
LoadModelData
(
FLAGS_model_data_file
.
c_str
());
NetDef
net_def
=
mace
::
MACE_MODEL_TAG
::
CreateNet
(
model_data
);
int64_t
t1
=
NowMicros
();
int64_t
t1
=
NowMicros
();
std
::
cout
<<
"CreateNetDef duration: "
<<
t1
-
t0
<<
" us"
<<
std
::
endl
;
std
::
cout
<<
"CreateNetDef duration: "
<<
t1
-
t0
<<
" us"
<<
std
::
endl
;
int64_t
init_micros
=
t1
-
t0
;
int64_t
init_micros
=
t1
-
t0
;
...
@@ -187,6 +195,9 @@ int main(int argc, char **argv) {
...
@@ -187,6 +195,9 @@ int main(int argc, char **argv) {
std
::
cout
<<
"Run init"
<<
std
::
endl
;
std
::
cout
<<
"Run init"
<<
std
::
endl
;
t0
=
NowMicros
();
t0
=
NowMicros
();
mace
::
MaceEngine
engine
(
&
net_def
,
device_type
);
mace
::
MaceEngine
engine
(
&
net_def
,
device_type
);
if
(
device_type
==
DeviceType
::
OPENCL
||
device_type
==
DeviceType
::
HEXAGON
)
{
mace
::
MACE_MODEL_TAG
::
UnloadModelData
(
model_data
);
}
t1
=
NowMicros
();
t1
=
NowMicros
();
init_micros
+=
t1
-
t0
;
init_micros
+=
t1
-
t0
;
std
::
cout
<<
"Net init duration: "
<<
t1
-
t0
<<
" us"
<<
std
::
endl
;
std
::
cout
<<
"Net init duration: "
<<
t1
-
t0
<<
" us"
<<
std
::
endl
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录