Add prelu layer support for caffe convert tool #4277

Merged
merged 2 commits into from Jan 11, 2017

Projects

None yet

2 participants

@fengshikun
Contributor

I add the support for prelu layer for the caffe convert tool, and use the code to convert the center loss(https://github.com/ydwen/caffe-face/blob/caffe-face/face_example/face_deploy.prototxt) model to mxnet model, which use prelu as its nonlinear activation function. And get the same output between mxnet and caffe.

fengshikun add prelu support
3aeec2c
tools/caffe_converter/convert_symbol.py
@@ -165,6 +165,10 @@ def proto2script(proto_file):
type_string = 'mx.symbol.BatchNorm'
param = layer[i].batch_norm_param
param_string = 'use_global_stats=%s' % param.use_global_stats
+ if layer[i].type == 'PReLU':
+ type_string = 'mx.symbol.LeakyReLU'
+ param_string = "act_type='prelu'"
@piiswrong
piiswrong Dec 18, 2016 Member

also need to copy slope parameter

@fengshikun
fengshikun Dec 19, 2016 Contributor

thanks, i will add it later

fengshikun fix params
6d42b2a
@piiswrong
Member

have you tested this on a real .proto?

@fengshikun
Contributor
fengshikun commented Dec 21, 2016 edited

@piiswrong Yes,i have used the code to convert the center loss(https://github.com/ydwen/caffe-face/blob/caffe-face/face_example/face_deploy.prototxt) model to mxnet model

@piiswrong piiswrong merged commit 541d109 into dmlc:master Jan 11, 2017

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
default Build finished.
Details
@rravu3 rravu3 pushed a commit to rravu3/mxnet that referenced this pull request Jan 21, 2017
@fengshikun fengshikun + Rahul Ravu Add prelu layer support for caffe convert tool (#4277)
* add prelu support

* fix params
cb52014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment