如何在tensorflow中使用微调模型?
我使用训练有素的AlexNet对我的数据库进行微调。现在,当我存储会话时,我得到了三个文件model.ckpt.meta、model.ckpt.index、model.ckpt.data。 现在,如何使用新的权重和模型来预测其他图像 还有,有没有办法以.npy格式存储权重 根据,使用Saver对象保存变量,并使用相同的对象加载。例如:如何在tensorflow中使用微调模型?,tensorflow,deep-learning,Tensorflow,Deep Learning,我使用训练有素的AlexNet对我的数据库进行微调。现在,当我存储会话时,我得到了三个文件model.ckpt.meta、model.ckpt.index、model.ckpt.data。 现在,如何使用新的权重和模型来预测其他图像 还有,有没有办法以.npy格式存储权重 根据,使用Saver对象保存变量,并使用相同的对象加载。例如: # Create some variables. v1 = tf.Variable(..., name="v1") v2 = tf.Variable(..., n
# Create some variables.
v1 = tf.Variable(..., name="v1")
v2 = tf.Variable(..., name="v2")
saver = tf.train.Saver()
if training:
initialize()
train()
save_path = saver.save(sess, "/tmp/model.ckpt") # save your variables
if testing:
saver.restore(sess, "/tmp/model.ckpt") # load your variables
predict()
TensorFlow变量以其自己的格式保存。要将变量保存为Numpy,您需要从会话中将张量获取为Numpy数组,然后使用Numpy保存/加载,如中所述:
为什么要这样做是很神秘的根据,使用Saver对象保存变量,然后使用相同的对象加载。例如:
# Create some variables.
v1 = tf.Variable(..., name="v1")
v2 = tf.Variable(..., name="v2")
saver = tf.train.Saver()
if training:
initialize()
train()
save_path = saver.save(sess, "/tmp/model.ckpt") # save your variables
if testing:
saver.restore(sess, "/tmp/model.ckpt") # load your variables
predict()
TensorFlow变量以其自己的格式保存。要将变量保存为Numpy,您需要从会话中将张量获取为Numpy数组,然后使用Numpy保存/加载,如中所述:
你为什么要这么做很神秘