Steren
Steren

Reputation: 7909

tensorflowjs_converter: SavedModel file does not exist at:

I am following the instructions here to import my Tensorflow model generated using Python into Tensorflow.js.

The model is created using a tf.estimator API, which auto saves the model files according to this page.

After installing tensorflowjs using pip, I get the following error when running the convert script:

$ tensorflowjs_converter     --input_format=tf_saved_model     --output_node_names='DeepWater'     /home/sterengiannini/deepwater/model-js-import-test     /home/sterengiannini/deepwater/web-model
Using TensorFlow backend.
Traceback (most recent call last):
  File "/usr/local/bin/tensorflowjs_converter", line 11, in <module>
    sys.exit(main())
  File "/home/sterengiannini/.local/lib/python2.7/site-packages/tensorflowjs/converters/converter.py", line 317, in main
    strip_debug_ops=FLAGS.strip_debug_ops)
  File "/home/sterengiannini/.local/lib/python2.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion.py", line 289, in convert_tf_saved_model
    input_saved_model_dir=saved_model_dir)
  File "/home/sterengiannini/.local/lib/python2.7/site-packages/tensorflow/python/tools/freeze_graph.py", line 338, in freeze_graph
    input_saved_model_dir, saved_model_tags).graph_def
  File "/home/sterengiannini/.local/lib/python2.7/site-packages/tensorflow/python/tools/saved_model_utils.py", line 42, in get_meta_graph_def
    saved_model = reader.read_saved_model(saved_model_dir)
  File "/home/sterengiannini/.local/lib/python2.7/site-packages/tensorflow/contrib/saved_model/python/saved_model/reader.py", line 55, in read_saved_model
    raise IOError("SavedModel file does not exist at: %s" % saved_model_dir)
IOError: SavedModel file does not exist at: /home/sterengiannini/deepwater/model-js-import-test

Here are the files present in the model folder:

$ ls model-js-import-test/
graph.pbtxt  model.ckpt-312.data-00000-of-00001  model.ckpt-312.index  model.ckpt-312.meta

Upvotes: 0

Views: 8169

Answers (1)

Anne Menini
Anne Menini

Reputation: 26

It looks like the model was not saved in the right format. You should expect something like the following in your model folder (see Structure of a SavedModel directory):

assets/
assets.extra/
variables/
    variables.data-?????-of-?????
    variables.index
saved_model.pb|saved_model.pbtxt

For, example, if you are using tf.estimator API, you need to export the model with the following (see Using SavedModel with Estimators):

estimator.export_savedmodel(export_dir_base, serving_input_receiver_fn)

Upvotes: 1

Related Questions