Errors when convert TF to Caffe
Platform (like ubuntu 18.04):
Python version: 3.6
Source framework with version (like Tensorflow 1.4.1 without GPU):
Destination framework with version (like Caffe 1.0 without GPU):
Pre-trained model path: mmdownload -f tensorflow -n mobilenet_v1_1.0_224
Running scripts:
I follow the instructions of the tensorflow to convert the mobilenet_v1_1.0_224.ckpt to caffe model.
The command I used in bash is:
mmconvert -sf tensorflow -in ./imagenet_mobilenet_v1_1.0.ckpt.meta -iw ./imagenet_mobilenet_v1_1.0.ckpt -df caffe --inputShape 224,224,3 --dstNodeName FeatureExtractor/MobilenetV1/Conv2d_13_pointwise_2_Conv2d_5_3x3_s2_128/Relu6 --inNodeName Preprocessor/sub -om mobilenet_v1_caffe
I directly copy that from the website. But I cann't get the results, the shell show me that:
Parse file [./imagenet_mobilenet_v1_1.0.ckpt.meta] with binary format successfully.
Tensorflow model file [./imagenet_mobilenet_v1_1.0.ckpt.meta] loaded successfully.
Tensorflow checkpoint file [./imagenet_mobilenet_v1_1.0.ckpt] loaded successfully. [137] variables loaded.
Traceback (most recent call last):
File "/home/hii/.local/bin/mmconvert", line 11, in
I guess maybe I miss some files during the mmdnn installation.
I also try the following command: mmtoir -f tensorflow -d mobilenet-v2 -n imagenet_mobilenet_v2_1.0_224.ckpt.meta -w imagenet_mobilenet_v2_1.0_224.ckpt --dstNodeName MMdnn_Output It works this time, but when I use the model in my code, it has errors. Obviously it doesn't been converted correctly.
Hi @hiigao , It's KeyError: "The following input nodes were not found: set([u'Preprocessor/sub'])\n" ,means this node is not in your checkpoint model file. Please try to figure out which is the right input node. Thanks!
Hi @hiigao, it is a untimely document updating problem. The README file is already updated. Please try it. If you still want to convert mobilenet_v1 checkpoint file to caffe, you can just use
mmconvert -sf tensorflow -in imagenet_mobilenet_v1_1.0.ckpt.meta -iw imagenet_mobilenet_v1_1.0.ckpt --dstNodeName MMdnn_Output -df caffe -om mobilenet_v1_caffe
And for your own model, you can use vis_meta command to get your own output node, usually the last fully connected layer's bias_add. Thanks.