Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
52659f48
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
52659f48
编写于
7月 10, 2018
作者:
B
Bin Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
conform android demo to new converter and docs
上级
f9011fde
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
68 addition
and
26 deletion
+68
-26
docs/user_guide/advanced_usage.rst
docs/user_guide/advanced_usage.rst
+2
-3
docs/user_guide/basic_usage.rst
docs/user_guide/basic_usage.rst
+2
-2
docs/user_guide/models/demo_models.yml
docs/user_guide/models/demo_models.yml
+0
-0
docs/user_guide/models/demo_models_caffe.yml
docs/user_guide/models/demo_models_caffe.yml
+0
-0
docs/user_guide/models/demo_models_tf.yml
docs/user_guide/models/demo_models_tf.yml
+0
-0
mace/examples/android/build.sh
mace/examples/android/build.sh
+6
-3
mace/examples/android/macelibrary/CMakeLists.txt
mace/examples/android/macelibrary/CMakeLists.txt
+8
-13
mace/examples/android/mobilenet.yml
mace/examples/android/mobilenet.yml
+41
-0
mace/python/tools/mace_engine_factory.h.jinja2
mace/python/tools/mace_engine_factory.h.jinja2
+9
-5
未找到文件。
docs/user_guide/advanced_usage.rst
浏览文件 @
52659f48
...
@@ -22,10 +22,9 @@ in one deployment file.
...
@@ -22,10 +22,9 @@ in one deployment file.
* **Example**
* **Example**
Here is an example deployment file with two models used by
Here is an example deployment file with two models.
`MACE Android demo application <https://github.com/XiaoMi/mace/blob/master/mace/examples/android>`__.
.. literalinclude:: models/demo_
app_
models.yml
.. literalinclude:: models/demo_models.yml
:language: yaml
:language: yaml
...
...
docs/user_guide/basic_usage.rst
浏览文件 @
52659f48
...
@@ -144,12 +144,12 @@ Modify one of them and use it for your own case.
...
@@ -144,12 +144,12 @@ Modify one of them and use it for your own case.
- TensorFlow
- TensorFlow
.. literalinclude:: models/demo_
app_
models_tf.yml
.. literalinclude:: models/demo_models_tf.yml
:language: yaml
:language: yaml
- Caffe
- Caffe
.. literalinclude:: models/demo_
app_
models_caffe.yml
.. literalinclude:: models/demo_models_caffe.yml
:language: yaml
:language: yaml
More details about model deployment file are in :doc:`advanced_usage`.
More details about model deployment file are in :doc:`advanced_usage`.
...
...
docs/user_guide/models/demo_
app_
models.yml
→
docs/user_guide/models/demo_models.yml
浏览文件 @
52659f48
文件已移动
docs/user_guide/models/demo_
app_
models_caffe.yml
→
docs/user_guide/models/demo_models_caffe.yml
浏览文件 @
52659f48
文件已移动
docs/user_guide/models/demo_
app_
models_tf.yml
→
docs/user_guide/models/demo_models_tf.yml
浏览文件 @
52659f48
文件已移动
mace/examples/android/build.sh
浏览文件 @
52659f48
...
@@ -3,10 +3,13 @@
...
@@ -3,10 +3,13 @@
set
-e
-u
-o
pipefail
set
-e
-u
-o
pipefail
pushd
../../../
pushd
../../../
python tools/converter.py build
--config
=
docs/user_guide/models/demo_app_models.yml
cp
-r
builds/mobilenet/include mace/examples/android/macelibrary/src/main/cpp/
python tools/converter.py convert
--config
=
mace/examples/android/mobilenet.yml
cp
-r
builds/mobilenet/lib mace/examples/android/macelibrary/src/main/cpp/
cp
-rf
builds/mobilenet/include mace/examples/android/macelibrary/src/main/cpp/
cp
-rf
builds/mobilenet/model mace/examples/android/macelibrary/src/main/cpp/
bash tools/build-standalone-lib.sh
cp
-rf
builds/lib mace/examples/android/macelibrary/src/main/cpp/
popd
popd
...
...
mace/examples/android/macelibrary/CMakeLists.txt
浏览文件 @
52659f48
...
@@ -14,18 +14,12 @@ cmake_minimum_required(VERSION 3.4.1)
...
@@ -14,18 +14,12 @@ cmake_minimum_required(VERSION 3.4.1)
include_directories
(
${
CMAKE_SOURCE_DIR
}
/
)
include_directories
(
${
CMAKE_SOURCE_DIR
}
/
)
include_directories
(
${
CMAKE_SOURCE_DIR
}
/src/main/cpp/include
)
include_directories
(
${
CMAKE_SOURCE_DIR
}
/src/main/cpp/include
)
file
(
GLOB static_file
${
CMAKE_SOURCE_DIR
}
/src/main/cpp/lib/arm64-v8a/*.a
)
set
(
mace_file
${
CMAKE_SOURCE_DIR
}
/src/main/cpp/lib/arm64-v8a/libmace.a
)
set
(
mobilenet_file
${
CMAKE_SOURCE_DIR
}
/src/main/cpp/model/mobilenet.a
)
MESSAGE
(
STATUS
"FILE URL =
${
CMAKE_SOURCE_DIR
}
"
)
add_library
(
mace_lib STATIC IMPORTED
)
MESSAGE
(
STATUS
"FILE URL =
${
static_file
}
"
)
set_target_properties
(
mace_lib PROPERTIES IMPORTED_LOCATION
${
mace_file
}
)
add_library
(
mobilenet_lib STATIC IMPORTED
)
foreach
(
fileStr
${
static_file
}
)
set_target_properties
(
mobilenet_lib PROPERTIES IMPORTED_LOCATION
${
mobilenet_file
}
)
set
(
tmpstr
${
fileStr
}
)
MESSAGE
(
STATUS
"FILE URL =
${
tmpstr
}
"
)
endforeach
()
add_library
(
mace_mobile_lib STATIC IMPORTED
)
set_target_properties
(
mace_mobile_lib PROPERTIES IMPORTED_LOCATION
${
tmpstr
}
)
add_library
(
# Sets the name of the library.
add_library
(
# Sets the name of the library.
mace_mobile_jni
mace_mobile_jni
...
@@ -55,7 +49,8 @@ find_library( # Sets the name of the path variable.
...
@@ -55,7 +49,8 @@ find_library( # Sets the name of the path variable.
target_link_libraries
(
# Specifies the target library.
target_link_libraries
(
# Specifies the target library.
mace_mobile_jni
mace_mobile_jni
mace_mobile_lib
mace_lib
mobilenet_lib
# Links the target library to the log library
# Links the target library to the log library
# included in the NDK.
# included in the NDK.
${
log-lib
}
)
${
log-lib
}
)
\ No newline at end of file
mace/examples/android/mobilenet.yml
0 → 100644
浏览文件 @
52659f48
library_name
:
mobilenet
target_abis
:
[
arm64-v8a
]
model_graph_format
:
code
model_data_format
:
code
models
:
mobilenet_v1
:
platform
:
tensorflow
model_file_path
:
https://cnbj1.fds.api.xiaomi.com/mace/miai-models/mobilenet-v1/mobilenet-v1-1.0.pb
model_sha256_checksum
:
71b10f540ece33c49a7b51f5d4095fc9bd78ce46ebf0300487b2ee23d71294e6
subgraphs
:
-
input_tensors
:
-
input
input_shapes
:
-
1,224,224,3
output_tensors
:
-
MobilenetV1/Predictions/Reshape_1
output_shapes
:
-
1,1001
runtime
:
cpu+gpu
limit_opencl_kernel_time
:
0
nnlib_graph_mode
:
0
obfuscate
:
0
winograd
:
0
mobilenet_v2
:
platform
:
tensorflow
model_file_path
:
https://cnbj1.fds.api.xiaomi.com/mace/miai-models/mobilenet-v2/mobilenet-v2-1.0.pb
model_sha256_checksum
:
369f9a5f38f3c15b4311c1c84c032ce868da9f371b5f78c13d3ea3c537389bb4
subgraphs
:
-
input_tensors
:
-
input
input_shapes
:
-
1,224,224,3
output_tensors
:
-
MobilenetV2/Predictions/Reshape_1
output_shapes
:
-
1,1001
runtime
:
cpu+gpu
limit_opencl_kernel_time
:
0
nnlib_graph_mode
:
0
obfuscate
:
0
winograd
:
0
mace/python/tools/mace_engine_factory.h.jinja2
浏览文件 @
52659f48
...
@@ -59,6 +59,10 @@ MaceStatus CreateMaceEngineFromCode(
...
@@ -59,6 +59,10 @@ MaceStatus CreateMaceEngineFromCode(
return MaceStatus::MACE_INVALID_ARGS;
return MaceStatus::MACE_INVALID_ARGS;
}
}
std::shared_ptr<NetDef> net_def;
std::shared_ptr<NetDef> net_def;
{% if embed_model_data %}
(void)model_data_file;
const unsigned char * model_data;
{% endif %}
MaceStatus status = MaceStatus::MACE_SUCCESS;
MaceStatus status = MaceStatus::MACE_SUCCESS;
switch (model_name_map[model_name]) {
switch (model_name_map[model_name]) {
{% for i in range(model_tags |length) %}
{% for i in range(model_tags |length) %}
...
@@ -66,12 +70,12 @@ MaceStatus CreateMaceEngineFromCode(
...
@@ -66,12 +70,12 @@ MaceStatus CreateMaceEngineFromCode(
net_def = mace::{{model_tags[i]}}::CreateNet();
net_def = mace::{{model_tags[i]}}::CreateNet();
engine->reset(new mace::MaceEngine(device_type));
engine->reset(new mace::MaceEngine(device_type));
{% if embed_model_data %}
{% if embed_model_data %}
(void)model_data_file;
model_data = mace::{{model_tags[i]}}::LoadModelData();
const unsigned char * model_data =
status = (*engine)->Init(net_def.get(), input_nodes, output_nodes,
mace::{{model_tags[i]}}::LoadModelData();
model_data);
status = (*engine)->Init(net_def.get(), input_nodes, output_nodes, model_data);
{% else %}
{% else %}
status = (*engine)->Init(net_def.get(), input_nodes, output_nodes, model_data_file);
status = (*engine)->Init(net_def.get(), input_nodes, output_nodes,
model_data_file);
{% endif %}
{% endif %}
break;
break;
{% endfor %}
{% endfor %}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录