简体   繁体   中英

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:

...
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. Adding dropout causes the val_acc to 0.0000, and from there it doesn't move.

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. each pixel value is normalized in the range 0-1 i am sure that the eyes coords are correct.

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. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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