【发布时间】:2018-04-13 05:41:09
【问题描述】:
我正在尝试根据重建图像的梯度和地面实况优化我的网络,但收到此错误
InvalidArgumentError:输入不可逆。
我认为这是因为 tensorflow 想要通过图像转换进行反向传播。我该如何解决这个问题?
def image_gradient_loss(y_prediction, y):
gradient_loss = tf.abs(tf.abs(y_prediction - tf.contrib.image.transform(y_prediction, [1, 0, 1, 0, 0, 0, 0, 0])) - tf.abs(y - tf.contrib.image.transform(y, [1, 0, 1, 0, 0, 0, 0, 0]))) + \
tf.abs(tf.abs(y_prediction - tf.contrib.image.transform(y_prediction, [0, 0, 0, 0, 1, 1, 0, 0])) - tf.abs(y - tf.contrib.image.transform(y, [0, 0, 0, 0, 1, 1, 0, 0])))
return tf.reduce_mean(gradient_loss)
loss = image_gradient_loss(y_pred, y)
optimizer = tf.train.RMSPropOptimizer(learning_rate=0.001).minimize(loss)
【问题讨论】:
标签: tensorflow