Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
Mace
提交
78a2b5ec
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看板
提交
78a2b5ec
编写于
12月 06, 2018
作者:
L
lichao18
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add channel shuffel caffe convert
上级
f002c764
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
0 deletion
+22
-0
mace/python/tools/converter_tool/caffe_converter.py
mace/python/tools/converter_tool/caffe_converter.py
+12
-0
mace/python/tools/converter_tool/shape_inference.py
mace/python/tools/converter_tool/shape_inference.py
+5
-0
third_party/caffe/caffe.proto
third_party/caffe/caffe.proto
+5
-0
未找到文件。
mace/python/tools/converter_tool/caffe_converter.py
浏览文件 @
78a2b5ec
...
@@ -187,6 +187,7 @@ class CaffeConverter(base_converter.ConverterInterface):
...
@@ -187,6 +187,7 @@ class CaffeConverter(base_converter.ConverterInterface):
'BatchNorm'
:
self
.
convert_folded_batchnorm
,
'BatchNorm'
:
self
.
convert_folded_batchnorm
,
'Crop'
:
self
.
convert_crop
,
'Crop'
:
self
.
convert_crop
,
'Scale'
:
self
.
convert_scale
,
'Scale'
:
self
.
convert_scale
,
'ShuffleChannel'
:
self
.
convert_channel_shuffle
,
}
}
self
.
_option
=
option
self
.
_option
=
option
self
.
_mace_net_def
=
mace_pb2
.
NetDef
()
self
.
_mace_net_def
=
mace_pb2
.
NetDef
()
...
@@ -656,3 +657,14 @@ class CaffeConverter(base_converter.ConverterInterface):
...
@@ -656,3 +657,14 @@ class CaffeConverter(base_converter.ConverterInterface):
ConverterUtil
.
add_data_format_arg
(
biasadd_op
,
ConverterUtil
.
add_data_format_arg
(
biasadd_op
,
DataFormat
.
NCHW
)
DataFormat
.
NCHW
)
def
convert_channel_shuffle
(
self
,
caffe_op
):
op
=
self
.
convert_general_op
(
caffe_op
)
param
=
caffe_op
.
layer
.
shuffle_channel_param
op
.
type
=
MaceOp
.
ChannelShuffle
.
name
group_arg
=
op
.
arg
.
add
()
group_arg
.
name
=
MaceKeyword
.
mace_group_str
group_arg
.
i
=
1
if
param
.
HasField
(
'group'
):
group_arg
.
i
=
param
.
group
mace/python/tools/converter_tool/shape_inference.py
浏览文件 @
78a2b5ec
...
@@ -48,6 +48,7 @@ class ShapeInference(object):
...
@@ -48,6 +48,7 @@ class ShapeInference(object):
MaceOp
.
FullyConnected
.
name
:
self
.
infer_shape_fully_connected
,
MaceOp
.
FullyConnected
.
name
:
self
.
infer_shape_fully_connected
,
MaceOp
.
Crop
.
name
:
self
.
infer_shape_crop
,
MaceOp
.
Crop
.
name
:
self
.
infer_shape_crop
,
MaceOp
.
BiasAdd
.
name
:
self
.
infer_shape_general
,
MaceOp
.
BiasAdd
.
name
:
self
.
infer_shape_general
,
MaceOp
.
ChannelShuffle
.
name
:
self
.
infer_shape_channel_shuffle
,
}
}
self
.
_net
=
net
self
.
_net
=
net
...
@@ -220,3 +221,7 @@ class ShapeInference(object):
...
@@ -220,3 +221,7 @@ class ShapeInference(object):
mace_check
(
len
(
op
.
input
)
==
2
,
"crop layer needs two inputs"
)
mace_check
(
len
(
op
.
input
)
==
2
,
"crop layer needs two inputs"
)
output_shape
=
self
.
_output_shape_cache
[
op
.
input
[
1
]]
output_shape
=
self
.
_output_shape_cache
[
op
.
input
[
1
]]
self
.
add_output_shape
(
op
,
[
output_shape
])
self
.
add_output_shape
(
op
,
[
output_shape
])
def
infer_shape_channel_shuffle
(
self
,
op
):
output_shape
=
self
.
_output_shape_cache
[
op
.
input
[
0
]]
self
.
add_output_shape
(
op
,
[
output_shape
])
third_party/caffe/caffe.proto
浏览文件 @
78a2b5ec
...
@@ -421,6 +421,7 @@ message LayerParameter {
...
@@ -421,6 +421,7 @@ message LayerParameter {
optional
ThresholdParameter
threshold_param
=
128
;
optional
ThresholdParameter
threshold_param
=
128
;
optional
TileParameter
tile_param
=
138
;
optional
TileParameter
tile_param
=
138
;
optional
WindowDataParameter
window_data_param
=
129
;
optional
WindowDataParameter
window_data_param
=
129
;
optional
ShuffleChannelParameter
shuffle_channel_param
=
164
;
}
}
// Message that stores parameters used to apply transformation
// Message that stores parameters used to apply transformation
...
@@ -1439,3 +1440,7 @@ message PReLUParameter {
...
@@ -1439,3 +1440,7 @@ message PReLUParameter {
// Whether or not slope parameters are shared across channels.
// Whether or not slope parameters are shared across channels.
optional
bool
channel_shared
=
2
[
default
=
false
];
optional
bool
channel_shared
=
2
[
default
=
false
];
}
}
message
ShuffleChannelParameter
{
optional
uint32
group
=
1
[
default
=
1
];
// The number of group
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录