how to get the pb file?
when I try to convert ckpt with pbtxt to pb file, error occurs.
python -m tensorflow.python.tools.freeze_graph --input_graph=efficientDet\model_0330.pbtxt --output_graph=efficientDet\model_0330.pb --output_node_names=box_net/box-predict_4/BiasAdd,class_net/class-predict_4/BiasAdd --input_checkpoint=efficientDet\export_model_0330 --clear_devices
2020-03-30 15:49:52.940855: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2020-03-30 15:49:52.945711: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
W0330 15:49:56.690041 13300 deprecation.py:323] From C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\tools\freeze_graph.py:127: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
2020-03-30 15:49:57.119829: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2020-03-30 15:49:57.124580: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)
2020-03-30 15:49:57.131616: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: hxs8603-win10
2020-03-30 15:49:57.135904: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: hxs8603-win10
2020-03-30 15:49:57.139406: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Traceback (most recent call last):
File "C:\Users\hxs8603\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\hxs8603\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\tools\freeze_graph.py", line 491, in <module>
run_main()
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\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 "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "C:\Users\hxs8603\AppData\Local\Programs\Python\Python37\lib\site-packages\absl\app.py", line 300, in run
_run_main(main, args)
File "C:\Users\hxs8603\AppData\Local\Programs\Python\Python37\lib\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\tools\freeze_graph.py", line 486, in <lambda>
my_main = lambda unused_args: main(unused_args, flags)
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\tools\freeze_graph.py", line 378, in main
flags.saved_model_tags, checkpoint_version)
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\tools\freeze_graph.py", line 361, in freeze_graph
checkpoint_version=checkpoint_version)
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\tools\freeze_graph.py", line 190, in freeze_graph_with_def_protos
var_list=var_list, write_version=checkpoint_version)
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\saver.py", line 828, in __init__
self.build()
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\saver.py", line 840, in build
self._build(self._filename, build_save=True, build_restore=True)
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\saver.py", line 878, in _build
build_restore=build_restore)
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\saver.py", line 482, in _build_internal
names_to_saveables)
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\saving\saveable_object_util.py", line 343, in validate_and_slice_inputs
for converted_saveable_object in saveable_objects_for_op(op, name):
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\saving\saveable_object_util.py", line 206, in saveable_objects_for_op
variable, "", name)
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\training\saving\saveable_object_util.py", line 83, in __init__
self.handle_op = var.op.inputs[0]
File "C:\Users\hxs8603\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\framework\ops.py", line 2154, in __getitem__
return self._inputs[i]
IndexError: list index out of range
You can run this:
python model_inspect.py --model_name=efficientdet-d0 --runmode=freeze --logdir=/tmp/pbout
Then your pb file would be in /tmp/pbout/
It seems the graphdef in model_inspec.ModelInspector.freeze_model() isn't saved in logdir.
The frozen graphdef is not saved, there is only a "xxx_train.pb" model saved, but it's not a frozen protobuf for inference.
@dreamibor and @huangxiaosa Did you get frozen_graph.pb with any of the above methods? Please share it with us.