Models: can't export the trained model for inference

Created on 21 Sep 2017  路  2Comments  路  Source: tensorflow/models

Dear Experts:

I am trying to export the trained model for inference:
(tensorflow) [root@SZX1000358305 models]# python object_detection/export_inference_graph.py --input_type image_tensor --pipeline_config_path object_detection/faster_rcnn_resnet101_pets.config --trained_checkpoint_prefix object_detection/ --output_directory output_inference_graph.pb

But I encountered a series of errors;

2017-09-21 18:51:27.028847: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open ./object_detection: Failed precondition: object_detection: perhaps your file is in a different file format and you need to use a different restore operator?
tensorflow.python.framework.errors_impl.NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for object_detection/
[[Node: save/RestoreV2_579 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2_579/tensor_names, save/RestoreV2_579/shape_and_slices)]]

It says that can not find the necessary files under object-detection, but actually the model.ckpt* & checkpoint & graph.pbtxt are there,

(tensorflow) [root@SZX1000358305 models]# ls object_detection/model.ckpt-200.
model.ckpt-200.data-00000-of-00001 model.ckpt-200.index model.ckpt-200.meta
(tensorflow) [root@SZX1000358305 models]# ls object_detection/model.ckpt-200.*
object_detection/model.ckpt-200.data-00000-of-00001 object_detection/model.ckpt-200.index object_detection/model.ckpt-200.meta
(tensorflow) [root@SZX1000358305 models]# ls object_detection/checkpoint
object_detection/checkpoint
(tensorflow) [root@SZX1000358305 models]# ls object_detection/graph.pbtxt
object_detection/graph.pbtxt
(tensorflow) [root@SZX10003583

Any idea what's the problem?

Most helpful comment

Thanks, I change to model.ckpt-200 and the problem is solved

All 2 comments

trained_checkpoint_prefix should point directly to the model.ckpt. For example:
--trained_checkpoint_prefix object_detection/model.ckpt

Also, note that output_directory should have the path where you want to save the exported model (it will create the folder for you). So putting output_inference_graph.pb there might lead to some confusion later when performing predictions.

Thanks, I change to model.ckpt-200 and the problem is solved

Was this page helpful?
0 / 5 - 0 ratings