Never do this noob mistake when using Keras or when processing large data
You know I have been trying to train a Keras model to predict the phonetic of a word for more than a day, I run the code fit the data, accuracy is like 89% but when I predict the phonetic of a word, it puts out some random gibberish.
I was like what is going on with this model, accuracy is like 89% but putting out some random data, retrained and trained and trained the system for more than a day with different models but I faced the same problem, I have this like why is this not working and I was loosing my mind, then I saw the line which saves the model to disk. The next minute I was like I should kill myself. CAn you guess what I was doing wrong?? Here I will show you some lines
model.save(model_file_path)
model.fit(x_train, y_train, batch_size=64, epochs=10)
score = model.evaluate(x_test,y_test, batch_size=16)
can you see the mistake over there? I was saving the model before even fitting the data, All the values it had was some random numbers :|
The code should have been
model.fit(x_train, y_train, batch_size=64, epochs=10)
model.save(model_file_path)
score = model.evaluate(x_test,y_test, batch_size=16)
So people, double check the scripts which saves the data to disk, if there is any problem during saving of data, it will be too late and you could lose some precious time :)