tensorflow / tensorflow/models

Instructions Doesn't Work for Freezing Nasnet and PNasNet

Open
#9,046 0 comments 0 reactions 2 assignees View on GitHub

@marksandler2 is already working on this.

Since Aug 5, 2020.

models:research type:docs
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

Prerequisites

Please answer the following question for yourself before submitting an issue.

  • [x ] I checked to make sure that this issue has not been filed already.

1. The entire URL of the documentation with the issue

https://github.com/tensorflow/models/tree/master/research/slim

2. Describe the issue

The description provided to freeze the models works only with ".ckpt" files. The checkpoints provided for NasNet and PNasNet models doesn't work with the "freeze_graph". Here is the command I used and the output:

Command:

freeze_graph \
    --input_graph=nasnet_large.pb \
    --input_checkpoint=model.ckpt.data-00000-of-00001 \                                                                                                                                                                                                              
    --input_binary=true --output_graph=nasnet_large.pb \
    --output_node_names=Merge_1/MergeSummary

Error:

2020-08-04 18:58:49.048090: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open ../nasnet/model.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
Traceback (most recent call last):
  File "/home/mcavus/Workspace/model_checker/env/bin/freeze_graph", line 8, in <module>
    sys.exit(run_main())
  File "/home/mcavus/Workspace/model_checker/env/lib/python3.6/site-packages/tensorflow_core/python/tools/freeze_graph.py", line 487, in run_main
    app.run(main=my_main, argv=[sys.argv[0]] + unparsed)
  File "/home/mcavus/Workspace/model_checker/env/lib/python3.6/site-packages/tensorflow_core/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/home/mcavus/Workspace/model_checker/env/lib/python3.6/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/home/mcavus/Workspace/model_checker/env/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "/home/mcavus/Workspace/model_checker/env/lib/python3.6/site-packages/tensorflow_core/python/tools/freeze_graph.py", line 486, in <lambda>
    my_main = lambda unused_args: main(unused_args, flags)
  File "/home/mcavus/Workspace/model_checker/env/lib/python3.6/site-packages/tensorflow_core/python/tools/freeze_graph.py", line 378, in main
    flags.saved_model_tags, checkpoint_version)
  File "/home/mcavus/Workspace/model_checker/env/lib/python3.6/site-packages/tensorflow_core/python/tools/freeze_graph.py", line 361, in freeze_graph
    checkpoint_version=checkpoint_version)
  File "/home/mcavus/Workspace/model_checker/env/lib/python3.6/site-packages/tensorflow_core/python/tools/freeze_graph.py", line 164, in freeze_graph_with_def_protos
    reader = pywrap_tensorflow.NewCheckpointReader(input_checkpoint)
  File "/home/mcavus/Workspace/model_checker/env/lib/python3.6/site-packages/tensorflow_core/python/pywrap_tensorflow_internal.py", line 873, in NewCheckpointReader
    return CheckpointReader(compat.as_bytes(filepattern))
  File "/home/mcavus/Workspace/model_checker/env/lib/python3.6/site-packages/tensorflow_core/python/pywrap_tensorflow_internal.py", line 885, in __init__
    this = _pywrap_tensorflow_internal.new_CheckpointReader(filename)
tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file ../nasnet/model.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?

Thank you,
Mustafa

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.