You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am tring to convert a mxnet model into a caffe model. The feature maps of 'conv1a' layer in mxnet and caffe are the same, but the feature maps of 'bn' layer in mxnet differs from the ones in caffe. The parameters 'moving_men', 'moving_var', 'gamma', 'beta' of mxnet model are suitable put into the caffe model.
And, when i tried to test the caffe model on ilsvrc2012 val, predicted classes of all images are 0. There must be some mistakes when i converted the model.
This bothers me for quite a while,can u give me some suggestions? thx a lot~
The text was updated successfully, but these errors were encountered:
I guess the mismatched feature map size is caused by the Pooling layer, because Caffe and MXNet use different default rounding strategy for the Pooling layer. So, you may need to add an option "ceil_mode: false" in Caffe's prototxt for the pooling layer(s).
If the solution above does not help you fix the problem, you may need to check if all parameters are copied from the MXNet Model.
( if everything else fails, checking the output consistency layer by layer can help you find the problem. )
You will encounter all zero output for this particular case, because:
The first BatchNorm layer uses "fixed gamma", which causes some problem when copying the "bn_data_gamma" from MXNet model to Caffe model.
The json2prototxt.py is still NOT fully automatic and cannot deal with this case. To solve the problem, you have to either change the code or manually delete the scaling layer below:
layer {
bottom: "data"
top: "bn_data"
name: "bn_data"
type: "BatchNorm"
batch_norm_param {
use_global_stats: true
moving_average_fraction: 0.9
eps: 0.00001 # you may also need to manually set eps base the .json file
}
}
# ---- delete lines below
layer {
bottom: "bn_data"
top: "bn_data"
name: "bn_data_scale"
type: "Scale"
scale_param { bias_term: true }
}
# ---- delete lines above
I am tring to convert a mxnet model into a caffe model. The feature maps of 'conv1a' layer in mxnet and caffe are the same, but the feature maps of 'bn' layer in mxnet differs from the ones in caffe. The parameters 'moving_men', 'moving_var', 'gamma', 'beta' of mxnet model are suitable put into the caffe model.
And, when i tried to test the caffe model on ilsvrc2012 val, predicted classes of all images are 0. There must be some mistakes when i converted the model.
This bothers me for quite a while,can u give me some suggestions? thx a lot~
The text was updated successfully, but these errors were encountered: