Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
Mace
提交
23d985f7
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看板
提交
23d985f7
编写于
5月 22, 2019
作者:
叶
叶剑武
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'update-onnx-converter' into 'master'
update onnx converter See merge request !1114
上级
b3526d30
0d924fc7
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
21 addition
and
12 deletion
+21
-12
docker/mace-dev-lite/Dockerfile
docker/mace-dev-lite/Dockerfile
+1
-1
docker/mace-dev/Dockerfile
docker/mace-dev/Dockerfile
+1
-1
docs/installation/env_requirement.rst
docs/installation/env_requirement.rst
+1
-1
include/mace/port/file_system.h
include/mace/port/file_system.h
+1
-0
mace/python/tools/converter_tool/onnx_converter.py
mace/python/tools/converter_tool/onnx_converter.py
+16
-5
mace/utils/statistics.cc
mace/utils/statistics.cc
+0
-3
setup/optionals.txt
setup/optionals.txt
+1
-1
未找到文件。
docker/mace-dev-lite/Dockerfile
浏览文件 @
23d985f7
...
...
@@ -136,7 +136,7 @@ RUN pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors
torchvision
==
0.2.2.post3
RUN
pip
install
-i
http://mirrors.aliyun.com/pypi/simple/
--trusted-host
mirrors.aliyun.com
\
onnx
==
1.
3
.0
\
onnx
==
1.
5
.0
\
onnx-tf
==
1.2.0
RUN
pip
install
-i
http://mirrors.aliyun.com/pypi/simple/
--trusted-host
mirrors.aliyun.com
\
...
...
docker/mace-dev/Dockerfile
浏览文件 @
23d985f7
...
...
@@ -106,7 +106,7 @@ RUN pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors
torchvision
==
0.2.2.post3
RUN
pip
install
-i
http://mirrors.aliyun.com/pypi/simple/
--trusted-host
mirrors.aliyun.com
\
onnx
==
1.
3
.0
\
onnx
==
1.
5
.0
\
onnx-tf
==
1.2.0
RUN
pip
install
-i
http://mirrors.aliyun.com/pypi/simple/
--trusted-host
mirrors.aliyun.com
\
...
...
docs/installation/env_requirement.rst
浏览文件 @
23d985f7
...
...
@@ -76,7 +76,7 @@ Optional dependencies
- pip install filelock==3.0.0
- Required by run on Android
* - ONNX
- pip install onnx==1.
3
.0
- pip install onnx==1.
5
.0
- Required by ONNX model
For python dependencies,
...
...
include/mace/port/file_system.h
浏览文件 @
23d985f7
...
...
@@ -15,6 +15,7 @@
#ifndef MACE_PORT_FILE_SYSTEM_H_
#define MACE_PORT_FILE_SYSTEM_H_
#include <cerrno>
#include <string>
#include <memory>
...
...
mace/python/tools/converter_tool/onnx_converter.py
浏览文件 @
23d985f7
...
...
@@ -337,7 +337,7 @@ class OnnxConverter(base_converter.ConverterInterface):
OnnxOpType
.
Conv
.
name
:
self
.
convert_conv2d
,
OnnxOpType
.
ConvTranspose
.
name
:
self
.
convert_deconv
,
OnnxOpType
.
DepthToSpace
.
name
:
self
.
convert_depth_space
,
OnnxOpType
.
Dropout
.
name
:
self
.
convert_
identity
,
OnnxOpType
.
Dropout
.
name
:
self
.
convert_
dropout
,
OnnxOpType
.
DimRange
.
name
:
self
.
convert_dim_range
,
OnnxOpType
.
Div
.
name
:
self
.
convert_eltwise
,
OnnxOpType
.
Equal
.
name
:
self
.
convert_eltwise
,
...
...
@@ -369,6 +369,7 @@ class OnnxConverter(base_converter.ConverterInterface):
OnnxOpType
.
Relu
.
name
:
self
.
convert_activation
,
OnnxOpType
.
Reshape
.
name
:
self
.
convert_reshape
,
OnnxOpType
.
Reciprocal
.
name
:
self
.
convert_eltwise
,
OnnxOpType
.
ReduceMean
.
name
:
self
.
convert_reduce
,
OnnxOpType
.
Scale
.
name
:
self
.
convert_eltwise
,
OnnxOpType
.
Sigmoid
.
name
:
self
.
convert_activation
,
OnnxOpType
.
Slice
.
name
:
self
.
convert_slice
,
...
...
@@ -396,6 +397,8 @@ class OnnxConverter(base_converter.ConverterInterface):
ir_version
=
onnx_model
.
ir_version
opset_imp
=
onnx_model
.
opset_import
onnx
.
checker
.
check_model
(
onnx_model
)
self
.
_isKaldi
=
False
polish_available
=
True
...
...
@@ -404,7 +407,7 @@ class OnnxConverter(base_converter.ConverterInterface):
domain
=
imp
.
domain
version
=
imp
.
version
print
(
"constains ops domain: "
,
domain
,
"version:"
,
version
)
if
'kaldi
2onnx
'
in
domain
:
if
'kaldi'
in
domain
:
polish_available
=
False
self
.
_data_format
=
DataFormat
.
NONE
self
.
_isKaldi
=
True
...
...
@@ -656,14 +659,13 @@ class OnnxConverter(base_converter.ConverterInterface):
def
convert_concat
(
self
,
node
):
op
=
self
.
convert_general_op
(
node
)
op
.
type
=
MaceOp
.
Concat
.
name
axis_value
=
1
if
node
.
op_type
==
OnnxOpType
.
Concat
.
name
:
if
self
.
_isKaldi
is
False
:
mace_check
(
'axis'
in
node
.
attrs
,
'Concat op should have axis attribute.'
)
axis_value
=
node
.
attrs
[
'axis'
]
mace_check
(
axis_value
==
1
or
axis_value
==
-
3
,
"only support concat at channel dimension"
)
el
if
node
.
op_type
==
OnnxOpType
.
Append
.
nam
e
:
el
s
e
:
axis_value
=
-
1
axis_arg
=
op
.
arg
.
add
()
axis_arg
.
name
=
MaceKeyword
.
mace_axis_str
...
...
@@ -789,6 +791,12 @@ class OnnxConverter(base_converter.ConverterInterface):
axes_arg
.
name
=
'axes'
axes_arg
.
ints
.
extend
([
-
1
])
def
convert_dropout
(
self
,
node
):
op
=
self
.
convert_general_op
(
node
)
op
.
type
=
MaceOp
.
Identity
.
name
del
op
.
output
[
1
:]
del
op
.
output_shape
[
1
:]
def
convert_dynamic_lstm
(
self
,
node
):
op
=
self
.
convert_general_op
(
node
)
op
.
type
=
MaceOp
.
DynamicLSTM
.
name
...
...
@@ -1068,6 +1076,9 @@ class OnnxConverter(base_converter.ConverterInterface):
axis_arg
.
i
=
value
def
convert_gemm
(
self
,
node
):
if
self
.
_isKaldi
:
self
.
convert_affine
(
node
)
return
# only supports FullyConnected Style Gemm for now.
trans_a
=
node
.
attrs
[
'transA'
]
if
'transA'
in
node
.
attrs
else
0
trans_b
=
node
.
attrs
[
'transB'
]
if
'transB'
in
node
.
attrs
else
0
...
...
mace/utils/statistics.cc
浏览文件 @
23d985f7
...
...
@@ -131,9 +131,6 @@ int64_t StatMACs(const std::string &op_type,
output_shape
.
end
(),
1
,
std
::
multiplies
<
int64_t
>
());
}
else
if
(
op_type
==
"DynamicLSTM"
)
{
macs
=
output_shape
[
0
]
*
(
filter_shape
[
0
]
*
filter_shape
[
1
]
+
output_shape
[
1
]
*
filter_shape
[
0
]
/
4
);
}
return
macs
;
}
...
...
setup/optionals.txt
浏览文件 @
23d985f7
tensorflow>=1.8.0
scipy>=1.0.0
filelock>=3.0.0
onnx>=1.3.0
\ No newline at end of file
onnx>=1.5.0
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录