Closed fm64hylian closed 4 years ago
There are currently no plans to support text-format output at the moment.
Luckily, you can convert a binary .pb to a .pbtext in just a few lines of code:
import tensorflow as tf
import tfjs_graph_converter as tfjs_conv
# change these values as you need
PB_FILE = 'frozen.pb'
OUTPUT_DIRECTORY = '.'
PBTXT_FILE = 'frozen.pbtxt'
# load the graph
graph_def = tfjs_conv.util.GraphDef()
with open(PB_FILE, 'rb') as proto_file:
graph_def.ParseFromString(proto_file.read())
# save as pbtxt
tf.io.write_graph(graph_def, OUTPUT_DIRECTORY, PBTXT_FILE)
I might add an option to output to .pbtxt format in a future version.
Hope that helps!
thank you, that script generates a pbtxt.
Hi, I followed issue #4 to convert the bodypix model to a frozen.pb, is it possible to generate the .pbtxt file as well?
Thank you.