How to transform tensorflow checkpoint model(.meta .index .data) to frozen model (.pb)

Hey guys:

I want to transform this network, https://github.com/jiangsutx/SRN-Deblur, from tensorflow to nvidia tensorRT. It need a ‘.pb’ model file, but the project only giving three model files as follow:

  • deblur.model-52300.data-00000-of-00001
  • deblur.model-52300.index
  • deblur.model-52300.meta

So I want to transform these files to a ‘.pb’ file.

I have tested the ideas given by:

The problem is that both gave ideas are failed because of the get_checkpoint_state() and latest_checkpoint() giving None value.

Is this caused by the missing of checkpoint file?

Are there other ways to implement this?

Any idea is appreciated.

Thanks.

Hello,

this is not TensorRT related.

You can check the scripts provided by Google
https://github.com/petewarden/tensorflow_makefile/blob/master/tensorflow/python/tools/freeze_graph.py

have a look at this file freeze_graph.py, you can generate .pb file directly from a checkpoint file and a meta graph.
While executing freeze_graph.py, you can specify the input arguments like this:

--input_meta_graph=/path/to/your/meta/graph/model-1.meta  
 --input_checkpoint=/path/to/your/checkpoint/file/model-1  
 --output_graph=/tmp/frozen_graph.pb  
 --output_node_names="Openpose/concat_stage7"  
 --input_binary=True

Thanks for your help.