Tensorflow: How to convert .meta, .data and .index model files into one graph.pb file

前端 未结 4 1780

In tensorflow the training from the scratch produced following 6 files:

  1. events.out.tfevents.1503494436.06L7-BRM738
  2. model.ckpt-2248
4条回答
  •  旧时难觅i
    2020-11-28 06:56

    As it may be helpful for others, I also answer here after the answer on github ;-). I think you can try something like this (with the freeze_graph script in tensorflow/python/tools) :

    python freeze_graph.py --input_graph=/path/to/graph.pbtxt --input_checkpoint=/path/to/model.ckpt-22480 --input_binary=false --output_graph=/path/to/frozen_graph.pb --output_node_names="the nodes that you want to output e.g. InceptionV3/Predictions/Reshape_1 for Inception V3 "
    

    The important flag here is --input_binary=false as the file graph.pbtxt is in text format. I think it corresponds to the required graph.pb which is the equivalent in binary format.

    Concerning the output_node_names, that's really confusing for me as I still have some problems on this part but you can use the summarize_graph script in tensorflow which can take the pb or the pbtxt as an input.

    Regards,

    Steph

提交回复
热议问题