Skip to content
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

Convert caffemodel mobilenet #214

Open
ss481 opened this issue Jul 3, 2018 · 9 comments
Open

Convert caffemodel mobilenet #214

ss481 opened this issue Jul 3, 2018 · 9 comments

Comments

@ss481
Copy link

ss481 commented Jul 3, 2018

I want to convert a caffe model (https://github.com/chuanqi305/MobileNet-SSD) to mxnet model. When i run the command python convert_model.py MobileNetSSD_deploy.prototxt mobilenet_iter_73000.caffemodel ssd_converted or python convert_model.py MobileNetSSD_deploy.prototxt MobileNetSSD_deploy.caffemodel ssd_converted i get the following error:
Using mxnet as:
<module 'mxnet' from '/home/sstojanoski/.virtualenvs/mxnet/local/lib/python2.7/site-packages/mxnet/init.pyc'>
Warning: using pre-installed version of mxnet may cause unexpected error...
(export MXNET_EXAMPLE_SSD_DISABLE_PRE_INSTALLED=1) to prevent loading pre-installed mxnet.
Traceback (most recent call last):
File "convert_model.py", line 135, in
main()
File "convert_model.py", line 45, in main
prob, input_dim = proto2symbol(args.caffe_prototxt)
File "/home/sstojanoski/converter/mxnet-ssd-master/tools/caffe_converter/convert_symbol.py", line 306, in proto2symbol
sym, output_name, input_dim = proto2script(proto_file)
File "/home/sstojanoski/converter/mxnet-ssd-master/tools/caffe_converter/convert_symbol.py", line 227, in proto2script
max_size = math.sqrt(param.min_size[0] * param.max_size[0]) / input_dim[2]
IndexError: list index (0) out of range

@zhreshold
Copy link
Owner

the converter is too old and I do not have plan to fix it.

@ndcuong91
Copy link

ndcuong91 commented Jul 13, 2018

@stefanstojanoski I had the same trouble with you. Did you find the way to solve it?
@zhreshold Do you have any release for mobilenet 300x300?

@ndcuong91
Copy link

@stefanstojanoski @zhreshold
I have following error when convert:
Traceback (most recent call last):
File "/home/prdcv/Downloads/pycharm-community-2018.1.3/helpers/pydev/pydevd.py", line 1664, in
main()
File "/home/prdcv/Downloads/pycharm-community-2018.1.3/helpers/pydev/pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/prdcv/Downloads/pycharm-community-2018.1.3/helpers/pydev/pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/prdcv/PycharmProjects/gvh205/mxnet_ssd/tools/caffe_converter/convert_model.py", line 168, in
main()
File "/home/prdcv/PycharmProjects/gvh205/mxnet_ssd/tools/caffe_converter/convert_model.py", line 150, in main
wmat = wmat.reshape(arg_shape_dic[weight_name])
ValueError: cannot reshape array of size 288 into shape (32,32,3,3)

Do you guys have any suggestion to solve it?

@ss481
Copy link
Author

ss481 commented Jul 24, 2018

I am not converting the caffe model. You can train ssd_mobilenet512 with --data-shape 300. The model I trained got good accuracy 76% and is much faster that the model with 512 shape (82% accuracy). You can try this approach.

@ndcuong91
Copy link

@stefanstojanoski i know i could do it but my purpose is to build a network as small as possible. Now im trying to modify mobilenet's network in Mxnet as similar as possible with mobilenet-ssd-300 model in Caffe. Can you give me some suggestion to do it @zhreshold ?

@ndcuong91
Copy link

[Update] The caffe converter tool has issue with depthwise convolution layer in mobilenet. I fixed it manually and i could run mobilenet_ssd_300 model in Mxnet now with mAP=70.9% on VOC 2007

@ss481
Copy link
Author

ss481 commented Jul 26, 2018

@titikid Nice work. Can you send me the model, so i can try it? Thank you. My email is stefanstojanoski@hotmail.com

@madhavajay
Copy link

@titikid are you able to put your code for a MXNet MobileNet SSD 300 on GitHub so I can see and replicate it?

@ndcuong91
Copy link

@madhavajay you can use mobilenet_ssd_300 models in my repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants