How to use the freeze_graph.py tool in TensorFlow v1

Can I use the tool freeze_graph.pywith models saved through saver.savein TensorFlow v1? If so, how?

I have some code that looks something like this:

supervisor = tf.train.Supervisor(logdir=output_directory_path)

with supervisor.managed_session() as session:
    # train the model here
    supervisor.saver.save(session, output_directory_path)

This creates a directory containing:

checkpoint
output
output-16640.data-00000-of-00001
output-16640.index
output-16640.meta

Where outputis a directory containing files for intermediate stages of training. The rest of the files.

I understand that this is a meta-graph (file .meta) and its variables (file .data*) in saver v2 format. These files contain the data necessary for the tool freeze_graph.py, but it is unclear how to tell the tool to freeze_graph.pyload data from these files.

All these attempts generate an error message. Input checkpoint '...' doesn't exist!

python freeze_graph.py --input_checkpoint checkpoint --output_graph /tmp/out
python freeze_graph.py --input_checkpoint . --output_graph /tmp/out
python freeze_graph.py --input_checkpoint output-16640 --output_graph /tmp/out

freeze_graph.py 'input_checkpoint' may be a prefix if we're using Saver V2 format , --input_checkpoint, , , , , .

+6
1

@mrry , - ./. , , --input_graph --output_name_names.

python freeze_graph.py \
    --input_graph output/graph.pbtxt \
    --input_checkpoint ./output-16640 \
    --output_graph /tmp/out \
    --output_node_names <name>

, , freeze_graph.py Attempting to use uninitialized value ...; .

+9

Source: https://habr.com/ru/post/1015249/


All Articles