Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
f4061000
Mace
项目概览
Xiaomi
/
Mace
通知
107
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看板
未验证
提交
f4061000
编写于
4月 21, 2020
作者:
R
Riccardo
提交者:
GitHub
4月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for ReLU6 op in CAFFE (#621)
Add support for Clip op in CAFFE Co-authored-by:
N
riccardo
<
rgall@sertiscorp.com
>
上级
9a06864a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
1 deletion
+19
-1
third_party/caffe/Dockerfile
third_party/caffe/Dockerfile
+2
-0
third_party/caffe/caffe.proto
third_party/caffe/caffe.proto
+8
-1
tools/python/transform/caffe_converter.py
tools/python/transform/caffe_converter.py
+9
-0
未找到文件。
third_party/caffe/Dockerfile
浏览文件 @
f4061000
...
...
@@ -30,6 +30,8 @@ WORKDIR $CAFFE_ROOT
# FIXME: use ARG instead of ENV once DockerHub supports this
# https://github.com/docker/hub-feedback/issues/460
ENV
CLONE_TAG=1.0
# To enable Clip operation in CAFFE during validation, it's needed to set CLONE_TAG=master
# ENV CLONE_TAG=master
# ImportError in system pip wrappers after an upgrade.
# https://github.com/pypa/pip/issues/5599
...
...
third_party/caffe/caffe.proto
浏览文件 @
f4061000
...
...
@@ -437,7 +437,7 @@ message ParamSpec {
// NOTE
// Update the next available ID when you add a new LayerParameter field.
//
// LayerParameter next available layer-specific ID: 14
7 (last added: recurrent
_param)
// LayerParameter next available layer-specific ID: 14
9 (last added: clip
_param)
message
LayerParameter
{
optional
string
name
=
1
;
// the layer name
optional
string
type
=
2
;
// the layer type
...
...
@@ -494,6 +494,7 @@ message LayerParameter {
optional
ArgMaxParameter
argmax_param
=
103
;
optional
BatchNormParameter
batch_norm_param
=
139
;
optional
BiasParameter
bias_param
=
141
;
optional
ClipParameter
clip_param
=
148
;
optional
ConcatParameter
concat_param
=
104
;
optional
ContrastiveLossParameter
contrastive_loss_param
=
105
;
optional
ConvolutionParameter
convolution_param
=
106
;
...
...
@@ -778,6 +779,12 @@ message ArgMaxParameter {
optional
int32
axis
=
3
;
}
// Message that stores parameters used by ClipLayer
message
ClipParameter
{
required
float
min
=
1
;
required
float
max
=
2
;
}
message
ConcatParameter
{
// The axis along which to concatenate -- may be negative to index from the
// end (e.g., -1 for the last axis). Other axes must have the
...
...
tools/python/transform/caffe_converter.py
浏览文件 @
f4061000
...
...
@@ -164,6 +164,7 @@ class CaffeConverter(base_converter.ConverterInterface):
'PReLU'
:
ActivationType
.
PRELU
,
'TanH'
:
ActivationType
.
TANH
,
'Sigmoid'
:
ActivationType
.
SIGMOID
,
'Clip'
:
ActivationType
.
RELUX
,
}
def
__init__
(
self
,
option
,
src_model_file
,
src_weight_file
):
...
...
@@ -177,6 +178,7 @@ class CaffeConverter(base_converter.ConverterInterface):
'TanH'
:
self
.
convert_activation
,
'Sigmoid'
:
self
.
convert_activation
,
'PReLU'
:
self
.
convert_activation
,
'Clip'
:
self
.
convert_activation
,
'Pooling'
:
self
.
convert_pooling
,
'Concat'
:
self
.
convert_concat
,
'Slice'
:
self
.
convert_slice
,
...
...
@@ -506,6 +508,13 @@ class CaffeConverter(base_converter.ConverterInterface):
type_arg
.
s
=
six
.
b
(
ActivationType
.
LEAKYRELU
.
name
)
if
caffe_op
.
type
==
'Clip'
:
mace_check
(
caffe_op
.
layer
.
clip_param
.
min
==
0
,
"Mace only supports min == 0 Clip op"
)
limit_arg
=
op
.
arg
.
add
()
limit_arg
.
name
=
MaceKeyword
.
mace_activation_max_limit_str
limit_arg
.
f
=
caffe_op
.
layer
.
clip_param
.
max
def
convert_folded_batchnorm
(
self
,
caffe_op
):
op
=
self
.
convert_general_op
(
caffe_op
)
op
.
type
=
MaceOp
.
BatchNorm
.
name
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录