Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在tensorflow中使用微调模型?_Tensorflow_Deep Learning - Fatal编程技术网

如何在tensorflow中使用微调模型?

如何在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

我使用训练有素的AlexNet对我的数据库进行微调。现在,当我存储会话时,我得到了三个文件model.ckpt.meta、model.ckpt.index、model.ckpt.data。 现在,如何使用新的权重和模型来预测其他图像

还有,有没有办法以.npy格式存储权重

根据,使用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保存/加载,如中所述:

为什么要这样做是很神秘的

根据,使用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保存/加载,如中所述:

你为什么要这么做很神秘