darkflow
darkflow copied to clipboard
Cannot freeze graph
Hi, I see there are a lot of issues regarding freezing graphs as per #286 #348 #170 to deploy the networks on other devices so here is my progress and my current problem:
- We trained a network using a custom configuration and for two labels only.
- flow through the graph and save protobuf with
./flow --model cfg/v1/yolo-tiny-aadc.cfg --load 35875 --labels labels-TY-aadc.txt --savepb(works fine) - make sure protobuf is correct with
./flow --pbLoad built_graph/yolo-tiny-aadc.pb --metaLoad built_graph/yolo-tiny-aadc.meta --imgdir sample_img/(works fine) - freeze graph from tensorflow installation directory with
python python/tools/freeze_graph.py --input_graph=./built_graph/yolo-tiny-aadc.pb --input_checkpoint=./ckpt/yolo-tiny-aadc-35875 --output_graph=./frozen-yolo-tiny-aadc.pb --output_node_names=output --input_binary
we get this error:
Traceback (most recent call last):
File "python/tools/freeze_graph.py", line 382, in <module>
run_main()
File "python/tools/freeze_graph.py", line 379, in run_main
app.run(main=my_main, argv=[sys.argv[0]] + unparsed)
File "/home/mohamed/tensorflow/venv/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "python/tools/freeze_graph.py", line 378, in <lambda>
my_main = lambda unused_args: main(unused_args, flags)
File "python/tools/freeze_graph.py", line 272, in main
flags.saved_model_tags, checkpoint_version)
File "python/tools/freeze_graph.py", line 254, in freeze_graph
checkpoint_version=checkpoint_version)
File "python/tools/freeze_graph.py", line 128, in freeze_graph_with_def_protos
var_list=var_list, write_version=checkpoint_version)
File "/home/mohamed/tensorflow/venv/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1281, in __init__
self.build()
File "/home/mohamed/tensorflow/venv/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1293, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/mohamed/tensorflow/venv/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1330, in _build
build_save=build_save, build_restore=build_restore)
File "/home/mohamed/tensorflow/venv/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 756, in _build_internal
saveables = self._ValidateAndSliceInputs(names_to_saveables)
File "/home/mohamed/tensorflow/venv/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 663, in _ValidateAndSliceInputs
for converted_saveable_object in self.SaveableObjectsForOp(op, name):
File "/home/mohamed/tensorflow/venv/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 631, in SaveableObjectsForOp
variable)
TypeError: names_to_saveables must be a dict mapping string names to Tensors/Variables. Not a variable: Tensor("26-connected/biases:0", shape=(256,), dtype=float32)
solved by https://github.com/thtrieu/darkflow/issues/286#issuecomment-424213540