I have compiled Google Protobuf from the source and generated the protoc binary. Now, given a .pb file, i.e., tensorflow_inception_v3_stripped_optimized_quantized.pb how am I gonna be able to read its content without using the Tensorflow library ?
Currently, I can write a sample reader to dump the event of my .pb file later be read by tensorboardas following:
import tensorflow as tf
from tensorflow.python.platform import gfile
INCEPTION_LOG_DIR = '/tmp/inception_v3_log'
if not os.path.exists(INCEPTION_LOG_DIR):
os.makedirs(INCEPTION_LOG_DIR)
with tf.Session() as sess:
model_filename = './model/tensorflow_inception_v3_stripped_optimized_quantized.pb'
with gfile.FastGFile(model_filename, 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
_ = tf.import_graph_def(graph_def, name='')
#writer = tf.train.SummaryWriter(INCEPTION_LOG_DIR, graph_def)
writer=tf.summary.FileWriter(INCEPTION_LOG_DIR, graph_def)
writer.close()
However, I don't quite get the reason why I compiled protoc for? Can't it be used as a standalone reader? Or, the mentioned inception.pb file is already using Protocol buffer in the backend of the Tensorflow without the need of using protoc?
commands like these do generate error:
protoc --python_out=. tensorflow_inception_v3_stripped_optimized_quantized.pb
protoc --cpp_out=. tensorflow_inception_v3_stripped_optimized_quantized.pb
As I checked, .pb files are semi-readable, however, I could not find a solid answer to my question anywhere to directly parse this file's content. Am I missing something here? Thanks.