https://github.com/tensorflow/models/blob/master/object_detection/exporter.py#L294
has a extra line which make export ckpt to .pb fail:
Traceback (most recent call last):
File "object_detection/export_inference_graph.py", line 106, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "object_detection/export_inference_graph.py", line 102, in main
FLAGS.output_directory)
File "/home/scopeserver/RaidDisk/DeepLearning/mwang/models/object_detection/exporter.py", line 376, in export_inference_graph
optimize_graph, output_collection_name)
File "/home/scopeserver/RaidDisk/DeepLearning/mwang/models/object_detection/exporter.py", line 336, in _export_inference_graph
trained_checkpoint_prefix=trained_checkpoint_prefix)
File "/home/scopeserver/RaidDisk/DeepLearning/mwang/models/object_detection/exporter.py", line 294, in _write_graph_and_checkpoint
save_relative_paths=True)
TypeError: __init__() got an unexpected keyword argument 'save_relative_paths'
you need move out save_relative_paths=True in order to make export run pass.
------------ BTW----------
the read me here are wrong:
https://github.com/tensorflow/models/blob/master/object_detection/g3doc/exporting_models.md
python object_detection/export_inference_graph \
--input_type image_tensor \
--pipeline_config_path ${PIPELINE_CONFIG_PATH} \
--checkpoint_path model.ckpt-${CHECKPOINT_NUMBER} \
--inference_graph_path output_inference_graph.pb
the parameters are not right, you need to change as the following code:
python export_inference_graph \
--input_type image_tensor \
--pipeline_config_path path/to/ssd_inception_v2.config \
--trained_checkpoint_prefix path/to/model.ckpt \
--output_directory path/to/exported_model_directory
Please provide details about what platform you are using (operating system, architecture). Also include your TensorFlow version. Also, did you compile from source or install a binary? Make sure you also include the exact command if possible to produce the output included in your test case. If you are unclear what to include see the issue template displayed in the Github new issue template.
We ask for this in the issue submission template, because it is really difficult to help without that information. Thanks!
In particular, ensure you are using the latest version of TensorFlow, since earlier versions do not have the save_relative_paths option for Saver
this is not related to platform, but code issue. I am using the latest version of TF.
L294 here has save_relative_paths as input. I think there is no unit test run to find this error.
https://github.com/tensorflow/models/blob/master/object_detection/exporter.py#L294
the readme on line is mismatch with the code for parameter description.
Saver takes in the save_relative_paths in 1.2.1 so it should work with 1.2.1 and above.
/CC @jch1, can you comment, both on the save_relative_paths issue and the readme issue?
@reedwm hello, I ues python export_inference_graph.py to convert .ckpt to .pb files, but error occured when I ues :
python export_inference_graph.py
--input_type image_tensor
--pipeline_config_path /home/seven/ssd_mobilenets/models/ssd_mobilenet_v1_pets.config --trained_checkpoint_prefix /home/seven/ssd_mobilenets/result/model.ckpt-544830
--output_directory /home/seven/ssd_mobilenets/pb
the wrong is:
Exception AttributeError: AttributeError("'NoneType' object has no attribute 'ScopedTFStatus'",) in
@civilman628 @LiangHao92 could you provide information about the environments you're running in (TF, version, OS)?
@derekjchow I trained my model with tensorflow 1.3.0-rc0, and now I use tensorflow 1.3.0-rc2.
OS: Windows 10
Python Version: Python 3.5.3 :: Continuum Analytics, Inc.
Tensorflow Version: 1.1.0
Device Used: CPU
Code:
image = cv2.imread("C:\\Users\Amr Sherif\PycharmProjects\plate detector\\test\plate (1).jpg")
image_np_expanded = np.expand_dims(image, axis=0)
flags.DEFINE_string('input_type', 'image_tensor', image_np_expanded)
flags.DEFINE_string('pipeline_config_path',
'C:\\Users\Amr Sherif\PycharmProjects\plate detector\data\\faster_rcnn_resnet101_pets.config', 'Path to a pipeline_pb2.TrainEvalPipelineConfig config '
'file.')
flags.DEFINE_string('trained_checkpoint_prefix',
'model.ckpt-35', 'Path to trained checkpoint, typically of the form '
'path/to/model.ckpt')
flags.DEFINE_string('output_directory', 'C:\\Users\Amr Sherif\PycharmProjects\plate detector\\new files', 'Path to write outputs.')
Error:
TypeError: __init__() got an unexpected keyword argument 'save_relative_paths'
Note:
UPDATE (FIX)
in exporter.py
with session.Session() as sess:
saver = saver_lib.Saver(saver_def=input_saver_def)
##save_relative_paths=True)
commenting that save_relative_paths=True works for me.
I am using WINDOWS 10
TensorFLow 1.1.0
Anaconda/Python 3.5
Hi There,
We are checking to see if you still need help on this, as this seems to be considerably old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing.
If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.
Most helpful comment
in exporter.py
with session.Session() as sess:
saver = saver_lib.Saver(saver_def=input_saver_def)
##save_relative_paths=True)
commenting that save_relative_paths=True works for me.
I am using WINDOWS 10
TensorFLow 1.1.0
Anaconda/Python 3.5