Coder Social home page Coder Social logo

IR->Caffe? about mmdnn HOT 13 CLOSED

microsoft avatar microsoft commented on April 28, 2024
IR->Caffe?

from mmdnn.

Comments (13)

kitstar avatar kitstar commented on April 28, 2024

Hi @anwesha94 , the IR -> caffe is on-going. The running script is same as others, i.e. IRToCode -f caffe.
@TobeyQin Could you help with it? Thanks.

from mmdnn.

TobeyQin avatar TobeyQin commented on April 28, 2024

Please follow the steps on the issue #66 (step 2 and 3). Thanks.

from mmdnn.

anwesha94 avatar anwesha94 commented on April 28, 2024

Hi @TobeyQin ,
I tried to execute step 2 of the link. It gave the following error: "raise NotImplementedError("Destination [Caffe] is not implemented yet."
Do I have to reinstall MMdnn to get IRtoCaffe?
Thank you.

from mmdnn.

anwesha94 avatar anwesha94 commented on April 28, 2024

Hi, I reinstalled MMdnn. Now I get the following error:
Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/anwesha/.local/lib/python3.6/site-packages/mmdnn/conversion/_script/IRToCode.py", line 112, in <module> _main() File "/home/anwesha/.local/lib/python3.6/site-packages/mmdnn/conversion/_script/IRToCode.py", line 107, in _main ret = _convert(args) File "/home/anwesha/.local/lib/python3.6/site-packages/mmdnn/conversion/_script/IRToCode.py", line 9, in _convert from mmdnn.conversion.caffe.caffe_emitter import CaffeEmitter File "/home/anwesha/.local/lib/python3.6/site-packages/mmdnn/conversion/caffe/caffe_emitter.py", line 13, in <module> import cntk ModuleNotFoundError: No module named 'cntk'

from mmdnn.

anwesha94 avatar anwesha94 commented on April 28, 2024

I installed cntk and added the path. I could execute step 2 and 3 and generate the caffemodel. However, testing it with test data gave accuracy=0.08 while the actual accuracy is 79% in keras.

from mmdnn.

kitstar avatar kitstar commented on April 28, 2024

Hi @anwesha94,
what is your keras model data format? Caffe model takes NCHW data (channel first). If your keras model data format is NHWC (channel last, if you use tensorflow as backend), you should swapaxis your input data for caffe to use.

Or you can provide your model for us to test. Thanks.

from mmdnn.

anwesha94 avatar anwesha94 commented on April 28, 2024

Yes, I am using tensorflow as backend. It is using channel last format. I am using the cifar10 dataset for training and testing. I have shared the weights here in a zip file:
keras_cifar10_weight_0.zip

from mmdnn.

kitstar avatar kitstar commented on April 28, 2024

Then you should transpose your input data like caffe_input = np.transpose(image, [0, 3, 1, 2]) then feed into caffe, to get right result.

from mmdnn.

anwesha94 avatar anwesha94 commented on April 28, 2024

Hi, I changed the axes of input images to (2,0,1). All the predictions are 0. There is something wrong with my conversion. What can be the possible error?

from mmdnn.

kitstar avatar kitstar commented on April 28, 2024

@TobeyQin will help to investigate this problem, thanks.

from mmdnn.

qiudi0127 avatar qiudi0127 commented on April 28, 2024

who can help me solve this problem from IR to caffe. Thank you so much.

Parse file [IR/lenet_finetune.pb] with binary format successfully.
Traceback (most recent call last):
File "/Users/diqiu/anaconda/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/Users/diqiu/anaconda/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Users/diqiu/meituan/framework/MMdnn/mmdnn/conversion/_script/IRToCode.py", line 112, in
_main()
File "/Users/diqiu/meituan/framework/MMdnn/mmdnn/conversion/_script/IRToCode.py", line 107, in _main
ret = _convert(args)
File "/Users/diqiu/meituan/framework/MMdnn/mmdnn/conversion/_script/IRToCode.py", line 55, in _convert
emitter.run(args.dstModelPath, args.dstWeightPath, args.phase)
File "mmdnn/conversion/caffe/caffe_emitter.py", line 136, in run
super(CaffeEmitter, self).run(dstNetworkPath, dstWeightPath, phase)
File "mmdnn/conversion/common/DataStructure/emitter.py", line 21, in run
self.save_code(dstNetworkPath, phase)
File "mmdnn/conversion/common/DataStructure/emitter.py", line 53, in save_code
code = self.gen_code(phase)
File "mmdnn/conversion/caffe/caffe_emitter.py", line 124, in gen_code
func(current_node)
File "mmdnn/conversion/caffe/caffe_emitter.py", line 208, in emit_Pool
IR_node.get_attr('pads')[1],
TypeError: 'NoneType' object has no attribute 'getitem'

from mmdnn.

kitstar avatar kitstar commented on April 28, 2024

Hi @qiudi0127 , could you provide related files (models) for us to debug? Thanks.

from mmdnn.

anwesha94 avatar anwesha94 commented on April 28, 2024

@qiudi0127
The input layer name should be "data" in the deploy file. Currently the deploy generated in mmdnn names it as <...>_input. Change it to data and check if it works. I had a similar problem for accessing the blobs. This solved for me. However, I didn't get expected testing results.

from mmdnn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.