【发布时间】:2016-11-15 04:19:33
【问题描述】:
我是 TensorFlow 菜鸟。我已经从 deeppose 的开源实现中训练了一个 TensorFlow 模型,现在必须针对一组新图像运行该模型。
该模型是在大小为 100 * 100 的图像上训练的,因此我已将新图像集的大小调整为相同大小。我有 149 新图像来运行模型。运行模型时,出现以下错误。
InvalidArgumentError (see above for traceback): Assign requires shapes
of both tensors to match. lhs shape= [20] rhs shape= [48]
排队
saver = tf.train.Saver(tf.all_variables())
我怀疑经过训练的模型大小和测试图像大小不匹配。我不清楚如何解决这个问题。我从tf.all_variables() 调用中打印出变量列表。在这里
Tensor("Placeholder:0", shape=(128, 100, 100, 3), dtype=float32)
(11, 11, 3, 20)
conv1/weights:0
(20,)
conv1/biases:0
(5, 5, 20, 35)
conv2/weights:0
(35,)
conv2/biases:0
(3, 3, 35, 50)
conv4/weights:0
(50,)
conv4/biases:0
(3, 3, 50, 75)
conv5/weights:0
(75,)
conv5/biases:0
(300, 1024)
local1/weights:0
(1024,)
local1/biases:0
(1024, 1024)
local2/weights:0
(1024,)
local2/biases:0
(1024, 0)
softmax_linear/weights:0
(0,)
softmax_linear/biases:0
我不确定 RHS 参数的来源。我查看了所有配置文件,似乎没有任何参数指定此配置。
我们将不胜感激任何解决此问题的帮助。
【问题讨论】:
-
试试
saver = tf.train.Saver(tf.all_variables(), reshape=True) -
你能显示更大的堆栈跟踪吗?
-
@Fake - 重塑不起作用,但我已经解决了这个问题。谢谢老哥
标签: python tensorflow deep-learning