1. tensorflow模型文件打包成PB文件
import tensorflow as tf
from tensorflow.python.tools import freeze_graph
with tf.Graph().as_default():
with tf.device("/cpu:0"):
config = tf.ConfigProto(allow_soft_placement=True)
with tf.Session(config=config).as_
保存的文件有4个:
checkpoint
model-parameters.bin-46000.data-00000-of-00001
model-parameters.bin-46000.index
model-parameters.bin-46000.meta
读取代码:
from tensorflow.python import pywrap_tensorflow
with tf.Graph().as_default():
with tf.Session() as sess: