在TensorFlow中使用RMSE损失时,我收到的损失值smalerl小于1 [英] When using RMSE loss in TensorFlow I receive very small loss values smalerl than 1

查看:603
本文介绍了在TensorFlow中使用RMSE损失时,我收到的损失值smalerl小于1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个网络会生成这样的logit/输出:

Hello I have a network that produces logits / outputs like this:

logits = tf.placeholder(tf.float32, [None, 128, 64, 64]) // outputs
y = tf.placeholder(tf.float32, [None, 128, 64, 64]) // ground_truth, targets

-> y地面真实度值从[0, 255] to [0, 1]开始缩减,以增加执行力,因为我读过,最好使用范围[0, 1]

--> y ground truth values are downscaled from [0, 255] to [0, 1] in order to increase perforce as I have read it is better to use range [0, 1]

现在我要像这样计算RMSE/EuclideanLoss:

Now I want to calculate the RMSE / EuclideanLoss like this:

loss = tf.reduce_mean(tf.square(logits - y))

loss = tf.sqrt(tf.reduce_mean(tf.square(tf.subtract(y, logits))))

不确定哪个更好.

这样做时,我的损失值大约从1.开始,然后迅速下降至2.5e-4.当我在Caffe中将EuclideanLoss用于同一网络时,我的损失值大约从1000开始,一直下降到200.我在Tensorflow中做错什么了吗,或者为什么损耗值这么小?由于tensorboard的损耗值非常小,因此我无法真正跟踪它们.谁能帮我吗?

When doing so my loss values start at roughly 1. and then quickly go down to 2.5e-4. When I use the EuclideanLoss in Caffe for the same network my loss values starts from roughly 1000 and goes down to 200. Am I doing anything wrong in Tensorflow or why are the loss values that small? I can't really track the loss values in tensorboard since they are so small. Can anyone help me?

推荐答案

您建议的第一个损失是更好的损失(第二个损失是不必要的sqrt).

The first loss you propose is the better one (the second introduces an unnecessary sqrt).

等于或小于1的值似乎是唯一可能的值,因为您提供的值范围在0到1之间-因此,最大的错误可能是1.

Values equal to or smaller than 1 seem to be the only possible values since the range of values you provide is within 0 and 1 - so the biggest possible error is 1.

如果无法在张量板上看到损失,请尝试使用对数标度(图形下方的两个按钮之一)显示图形

If you have trouble visualising the loss in tensorboard, try showing the graphs using a log scale (one of the two buttons under the graphs)

这篇关于在TensorFlow中使用RMSE损失时,我收到的损失值smalerl小于1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆