MXNet2Caffe
MXNet2Caffe copied to clipboard
error! key error mxnet: mobilenet0_batchnorm0_beta
error! key error mxnet: mobilenet0_batchnorm0_beta error! key error mxnet: mobilenet0_batchnorm0_gamma Warning! unknown mxnet: mobilenet0_batchnorm0_runing_mean 转化模型师,出现以上错误,怎么解决?
I also have occured the same problem,have you solved?
Modified "mxnet2caffe.py". The reasons is that it take the parameter as moving mean with key work "_moving_mean" not "_runing_mean". So modify line37~70. Copy the two elif blocks "_moving_mean" and "_moving_var" and change the keywords to "_runing_mean" and "_runing_var"
@cypw hi ,I want to convert arcface to caffe ,now model last is Fully connected layer+bn(fc1) fc1 = mx.sym.BatchNorm(data=key_i, fix_gamma=True, eps=2e-5, momentum=0.9, name='fc1')
now from data to Fully connected layer caffe out is right, but the last bn is wrong, (but I use author model all right ,I finutinue this save new model,not to modify model code,now only the last bn is wrong) . Could you help me ? I don't know why? the code as follow: ## last bn fc elif '_moving_mean' in key_i: key_caffe = key_i.replace('_moving_mean', '') net.params[key_caffe][0].data.flat = aux_params[key_i].asnumpy().flat net.params[key_caffe][2].data[...] = 1 ## last bn fc elif '_moving_var' in key_i: key_caffe = key_i.replace('_moving_var', '') net.params[key_caffe][1].data.flat = aux_params[key_i].asnumpy().flat #get weight net.params[key_caffe][2].data[...] = 1
##the caffe as follow layer { bottom: "pre_fc1" top: "fc1" name: "fc1" type: "BatchNorm" batch_norm_param { use_global_stats: true moving_average_fraction: 0.9 eps: 2e-05 } } layer { bottom: "fc1" top: "fc1" name: "fc1_scale" type: "Scale" scale_param { bias_term: true } }
############## the test out,last bn out x: array([ 1.20850e+00, 3.41684e-01, 1.33299e+00, 1.69712e+00, -5.94079e-01, 5.64458e-01, 4.99271e-01, -4.05627e-01, -5.48919e-01, -8.93808e-02, 4.04169e-02, 7.23736e-01,... y: array([ 1.27053e+00, 3.60556e-01, 1.40213e+00, 1.78604e+00, -6.25261e-01, 5.95151e-01, 5.25208e-01, -4.26005e-01, -5.78033e-01, -9.44324e-02, 4.48017e-02, 7.61607e-01,...