microsoft / MMdnn

MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch Onnx and CoreML.
MIT License
5.79k stars 964 forks source link

Tensorflow has not supported operator [Softmax] with name [cls_fc/Softmax] #418

Open PapaMadeleine2022 opened 6 years ago

PapaMadeleine2022 commented 6 years ago

hello, my tf is tensorflow-gpu-1.4.1. when I run mmconvert -sf tensorflow -in RNet-20.meta -iw RNet-20 --dstNodeName cls_fc/Softmax -df caffe -om tf_RNet on my RNet-20, it still shows:

Parse file [RNet-20.meta] with binary format successfully.
Tensorflow model file [RNet-20.meta] loaded successfully.
Tensorflow checkpoint file [RNet-20] loaded successfully. [29] variables loaded.
Tensorflow has not supported operator [Softmax] with name [cls_fc/Softmax].

but my RNet-20.meta does has cls_fc/Softmax, how to fix it? my RNet-20.meta is here

PapaMadeleine2022 commented 6 years ago

need help~

namizzz commented 6 years ago

Hi @IvyGongoogle , thanks for your issue, we have fixed the problems!

Archernarkiu commented 5 years ago

@IvyGongoogle I am tring to convert tensorflow model of mtcnn now, but another error occurred :"

F0926 17:53:15.171332 1120 reshape_layer.cpp:87] Check failed: top[0]->count() == bottom[0]->count() (768 vs. 2) output count must match input count ** Check failure stack trace: ./run.sh: line 3: 1120 Aborted (core dumped) mmconvert -sf tensorflow -in model-30.meta -iw model-30.ckpt --dstNodeName cls_prob -df caffe -om tf_pnet**

". Could you offer me some advice, thanks.

namizzz commented 5 years ago

Hi @Archernarkiu , maybe it's better to new a issue~

liangheng commented 5 years ago

@IvyGongoogle I am tring to convert tensorflow model of mtcnn now, but another error occurred :"

F0926 17:53:15.171332 1120 reshape_layer.cpp:87] Check failed: top[0]->count() == bottom[0]->count() (768 vs. 2) output count must match input count ** Check failure stack trace: ./run.sh: line 3: 1120 Aborted (core dumped) mmconvert -sf tensorflow -in model-30.meta -iw model-30.ckpt --dstNodeName cls_prob -df caffe -om tf_pnet**

". Could you offer me some advice, thanks.

@Archernarkiu how about convert tensorflow model of mtcnn? I have the same doubt, please inform me. Thank you

Archernarkiu commented 5 years ago

@liangheng Emmmm, It has been half a year since I proposed this question. I failed to convert my model then, however I almost forgot the details. But I conclude that, maybe this tool would fix the graph's input while converting your input graph. I didn't feel strange now, cause many tools (tensortRT, tensorflow Lite), as far as I know, have this trait.

liangheng commented 5 years ago

@Archernarkiu thank you very much @namizzz @IvyGongoogle I use the following command: mmconvert -sf tensorflow -in E:/tmp/pnet-30.meta -iw E:/tmp/pnet-30.index --dstNode conv4_1/Softmax conv4_1/BiasAdd conv4_3/BiasAdd -df caffe -om E:/tmp/outmodel

it happen: Traceback (most recent call last): File "d:\softinstall\anaconda3\lib\runpy.py", line 184, in _run_module_as_main "main", mod_spec) File "d:\softinstall\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\SoftInstall\Anaconda3\Scripts\mmconvert.exe__main__.py", line 9, in File "d:\softinstall\anaconda3\lib\site-packages\mmdnn\conversion_script\convert.py", line 102, in _main ret = convertToIR._convert(ir_args) File "d:\softinstall\anaconda3\lib\site-packages\mmdnn\conversion_script\convertToIR.py", line 115, in _convert parser.run(args.dstPath) File "d:\softinstall\anaconda3\lib\site-packages\mmdnn\conversion\common\DataStructure\parser.py", line 22, in run self.gen_IR() File "d:\softinstall\anaconda3\lib\site-packages\mmdnn\conversion\tensorflow\tensorflow_parser.py", line 424, in gen_IR func(current_node) File "d:\softinstall\anaconda3\lib\site-packages\mmdnn\conversion\tensorflow\tensorflow_parser.py", line 552, in rename_Conv2D self.set_weight(node_name, 'weights', self.ckpt_data[W.name]) KeyError: 'conv1/weights'

need help

liangheng commented 5 years ago

I used my own script to implement the transformation, but the precision was lost, I don't know why