-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
what tool did you use to convert mxnet to caffe ? #67
Comments
I guess you are using MXNet2Caffe and it hard coded batchnorm eps as 0.001 but eps=2e-05 in mxnet. I will test it. |
@GarrickLin Thank you. I didn't find out it. Please tell me the result once you finish it~ |
After replacing eps from 0.001 to 2e-05 in prototxt file, LFW result improved at 99.50%. There is still remaining some difference. |
Can you share the converting scripts here? |
@GarrickLin I mean the modified MXNet2Caffe program, can you share it? At least the input layers, PRelu layers must be adjusted to match our pretrained model. |
GarrickLin/MXNet2Caffe/blob/master/prototxt_basic.py Or you can just replace all |
@GarrickLin Thank you very much. Then other caffe guys can use it. |
Can you achieve the same result as mxnet model after modifying |
@GarrickLin I do not have time to test using Caffe model... I think someone else may want to. |
GarrickLin/MXNet2Caffe/blob/master/mxnet2caffe.py I have fix the prelu support, and now the results are exactly the same. |
@GarrickLin Very promising, thank you! Which model did you test? Resnet50? |
@GarrickLin Can I copy your code to this repo? |
Yes you can |
I have just tested with LResNet34E-IR |
hi@GarrickLin @nttstar, thank you all for your great help. name: "mxnet-mdoel" |
@GarrickLin Can you help? |
@GarrickLin @nttstar Can you give more details about how to convert the insightface model from mxnet to caffe? |
@ysc703 Same problem! |
I am really busy nowadays. I'll take care of this as soon as I have time. |
@YoWhatever @ysc703 @anguoyang I have met the same problem. Did you fix it? |
LResNet50.prototxt.txt |
@GarrickLin Thanks for the the proto file and the recommendation. Although the bottom names of conv0 layer and pre_fc1 layer need to be modified, it is really nice. |
@ysc703 can you share your modify code? thanks! |
maybe this: in "prototxt_basic.py": I am not sure about whether "elu_param { alpha: 0.25 }" is required for PReLU. The bottom names of conv0 and pre_fc1 should be change to "data" and "bn1", because some layers are removed. |
@ewrfcas thanks |
MXNet2Caffe is updated now |
@ewrfcas yes you should manually modify the prototxt file |
@nttstar @GarrickLin when I use your MXNet2Caffe code to convert mxnet LMobileNetE to caffe . It appear: Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNAL_ERROR. But when I convert mxnet model-r50-am-lfw to caffe,it's good. Did you fix it? |
@xubenxiang Sorry, I didn't try LMobileNetE. |
I converted mxnet50 to resnet50, and run the check_results. I got two same results. because, caffe prototxt not have preprocess, so if you want to got a right check_results ,you have to revise a few the .py |
hi, @GarrickLin @nttstar .Thank you for your sharing.When I trained se-resnet50-arcloss with ms1m datasets then I want to converted mxnetmodel to caffemodel but in the stage of "json2prototxt.py" the code have yet not worked well. Can you help me?The jsonfile and the error are as following: |
@yang0817manman |
Thanks for your reply. But when I run the code of "json2prototxt.py" and the many unknown layers appeared. How to modify the code I should ?Can you help me ?Thanks a lot. @jimeffry |
@ddwktv can you tell me how to modify a few the .py. I am worried. thanks. |
i have finished it and result is ok. you should change caffe's input nimg = (nimg-127.5) / 128 |
I want to converted mxnetmodel into caffemodel all the time but some error of "Warning! Skip Unknown mxnet op" always appeared. Can you tell me how to modify the code of "json2prototxt.py" or "mxnet2caffe.py"? Thanks a lot. @liu1004010308 |
https://blog.csdn.net/Wuzebiao2016/article/details/81735487 |
@liu1004010308,Thanks. I have tried to do it according to this blog and modify the prototxt file some times but it doesn't work. |
|
Does anyone know how to transfer from mxnet to caffe of MobileFacenet model? For the transformed caffe model, I also get the same feature results of different tensor input. How to solve this problem? Thank you. |
hi,did you modify the mxnet's json file to run the checkout_result.py,and how did you modify the prototxt file,can you share,thx. |
I used MMdnn to convert from MXNet to Caffe and it was very effortless. Their README explains on how to get started, however the dependencies can be pretty messy, so if it doesn't work, I suggest using Docker as follows:
Important: You need to specify a shared folder between your local filesystem and the container with
and upgraded
|
I figure out that the version of caffe matters.When using NVIDIA'caffe, the result of the converted model seems incorrect,since NVIDIA's caffe implements BN and scale layer together,so you'll find that the blobs mismatch.BTW,can anyone improve the tools so that people need not to manually modify the pt file. |
@ddfabbro It seems like using mmdnn to cvt model from mxnet to caffe will loss some precisions, I tested it by getting the feature of the same pic using mxnet and the converted caffe model, the similarity between the two features is 97.7%. |
@wsx276166228 |
The MMDNN works for me with no precision decline. |
I used to convert mobilefacenet from mxnet to caffe with MXNet2Caffe https://github.com/GarrickLin/MXNet2Caffe,but the output features totally different. I check some layer‘s’weights and features ,they remain the same. |
@
@liu1004010308 |
@ddwktv |
@marcosly |
@shiyuanyin you can try this,https://github.com/Laulian/MxNet2Caffe-mobilefacenet,I just tested with resnet-50 |
I realize the accurate conversion from MXNet model to Caffe Model by MMdnn. mmtoir -f mxnet -n downed_mxnet_model/resnext-101-symbol.json -w downed_mxnet_model/resnext-101-0000.params -d converted_caffe_model/resnext101 --inputSh ape 3,224,224 |
@Laulian , |
@shiyuanyin check the last layer's output of each bottleneck in resnet-50,that is the Eltwise layer.And you will figure out where the difference generated. |
@ Laulian ,Thank you your reply ,now transform my model is ok ,but I m not sure ,is wd or save model_0000 problem, because I use wd=0.0005 ,get the model is OK, before save model I use include fc model to save no fc model model-0000 |
@jimeffry 我也用的MxNet2Caffe进行的模型转换,在caffe上跑的识别结果非常离谱,可能是什么原因,谢谢 |
@jeehyun100 @jimeffry I test resnet50 caffemodel using lfw face dataset, the result is unnormal: the same face pair has higher cosine similarity, the value is around 0.8-0.9, and the different face pair also has high cosing similarity, the value is around 0.6. I thought this is not correct, the different face pair should not get so high similarity. Can anyone explain this question? thanks. |
No description provided.
The text was updated successfully, but these errors were encountered: