1

I trained and saved a keras model in json format and saved the weights in h5 format. The only issue is that each time I run predict, I get different results. There is no randomness when loading the data, I simply load the data (without shuffling), load the keras model and weights, and then run predict. I don't run the compile command, since it's not needed. Something I was wondering is if the dropout layers I added to the model contribute to this, but I read that they are automatically disabled for prediction/evaluation stages. Any ideas on why this might be happening?

  • According to the [comments on a related question](https://stackoverflow.com/questions/37382704/tensorflow-predictions-change-as-more-predictions-are-made), it might be a bug. Do you also get different results predicting with the original model right after training? I also wonder if predictions are computed by multiple threads and combined efficiently rather than predictably; then the order in which numbers are added or multiplied can vary, sometimes resulting in (very slightly) different outcomes. – Stein Jul 31 '19 at 18:50

0 Answers0