onnx / onnx-tensorflow

Tensorflow Backend for ONNX
Other
1.27k stars 296 forks source link

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' when convert ckpt #380

Open vera121 opened 5 years ago

vera121 commented 5 years ago

Describe the bug When I try to convert the TensorFlow in ckpt format to ONNX model using the command _onnx-tf convert -t onnx -i /home/yche/mobilenet_v1_1.0_224/mobilenet_v1_1.0_224.ckpt -o mobilenet_v1ckpt.onnx

The error shows up: _INFO:root:Start converting tf pb to onnx pb: Traceback (most recent call last): File "/home/yche/anaconda2/envs/python3/bin/onnx-tf", line 11, in load_entry_point('onnx-tf', 'console_scripts', 'onnx-tf')() File "/home/yche/onnx-tensorflow/onnx_tf/cli.py", line 22, in main return onnx_tf.converter.main(args[1:]) File "/home/yche/onnx-tensorflow/onnx_tf/converter.py", line 24, in main convert(**{k: v for k, v in vars(args).items() if v is not None}) File "/home/yche/onnx-tensorflow/onnx_tf/converter.py", line 196, in convert saver = tf.train.import_meta_graph(latestckpt + ".meta") TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

TensorFlow model file Downloaded at TensorFlow SLIM Pre-trained Models: mobilenet_v1_1.0_224.tgz

Python, ONNX, ONNX-TF, Tensorflow version Python version: 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) [GCC 7.3.0] ONNX version: 1.3.0 ONNX-TF version: 1.2.1 Tensorflow version: 1.8.0

ayermolo commented 5 years ago

I am also experiencing this problem.

fumihwh commented 5 years ago

@vera121 @aaronmarkham Seems latest_ckpt is None. Does a checkpoint file exist in your folder?

vera121 commented 5 years ago

@fumihwh Do you mean that we can only use a single ckpt file?

The downloaded file from the model is: mobilenet_v1_1.0_224.ckpt.data-00000-of-00001 mobilenet_v1_1.0_224.ckpt.index mobilenet_v1_1.0_224.ckpt.meta

I believe that is the common format for TensorFlow ckpt now. Can't the converter load these?

fumihwh commented 5 years ago

@vera121

File "/home/yche/onnx-tensorflow/onnx_tf/converter.py", line 196, in convert
saver = tf.train.import_meta_graph(latest_ckpt + ".meta")

You can change latest_ckpt + ".meta" to path/to/your/file. In tf, they use checkpoint to save the path of other files.