简体   繁体   English

Keras Tensorflow val_acc始终为1或从0跳转到1

[英]Keras Tensorflow val_acc always 1 or jumping from 0 to 1

In some network i noticed that the val_acc starts directly from 1.000 ex: 在某些网络中,我注意到val_acc直接从1.000 ex开始:

...
3/1667 [==============================] - 8s - loss: 0.0877 - acc: 0.0432 
- val_loss: 0.0814 - val_acc: 1.0000
Epoch 2/50

Obviously the accuracy is totally wrong, when testing the model horrible results occurs. 显然,在测试模型时,准确性是完全错误的。

it would seem to me that there is overfitting, but even when reducing LR this doesn't seem to cause any effect. 在我看来,这是过度拟合的,但是即使减小LR,这似乎也不会造成任何影响。 Adding dropout causes the val_acc to 0.0000, and from there it doesn't move. 添加删除会导致val_acc变为0.0000,并且从那里开始不会移动。

I'd expect a similar kind of accuracy from the test set and the validation test, but it would seem that the 2 values are not correlated at all 我希望测试集和验证测试具有类似的准确性,但似乎两个值根本不相关

edit to add informations: The input data is a batch of b/w images, with x/y coords that represents eyes position. 编辑以添加信息:输入数据是一批黑白图像,其中x / y坐标表示眼睛位置。 each pixel value is normalized in the range 0-1 i am sure that the eyes coords are correct. 每个像素值都在0-1的范围内归一化,我确定眼睛坐标正确。

The first thing to confirm would be whether the data is being loaded correctly and as intended. 首先要确认的是数据是否正确加载并按预期加载。 I encountered this issue while checking a colleague's code to train a CNN to perform image segmentation. 我在检查同事的代码以训练CNN进行图像分割时遇到了此问题。 It turned out that the input ground truth was all 0s (in the training data) and the network would just output 0s as well and get perfect accuracy. 事实证明,输入的地面真实情况(在训练数据中)全为0,并且网络也将仅输出0并获得完美的精度。

If the data seems to be correct, then using a different accuracy metric can also help in solving this problem. 如果数据看起来正确,则使用其他准确性度量标准也可以帮助解决此问题。 You can refer the documentation to see which metrics are available and are a close match to the problem you're trying to solve. 您可以参考文档以查看哪些指标可用,并且与您要解决的问题非常匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM