Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prediction incorrect when load saved model #88

Open
MaJieCornell opened this issue Oct 6, 2017 · 2 comments
Open

Prediction incorrect when load saved model #88

MaJieCornell opened this issue Oct 6, 2017 · 2 comments

Comments

@MaJieCornell
Copy link

Hi,

Now I am using Keras 1.2.2 with mxnet backend on ResNet50. I observed a very weird phenomenon:

If we use mxnet as backend, when we finish training and save the model to disk (by model.save_weight(…)), then reload the model to do the prediction, we will get almost the same ouput for training data. In other word, we use the reloaded model to predict on the training data, all output will be almost the same and classify everything to one category. This shouldn’t happen since we have very high training accuracy. If we directly use trained model to predict on training data (without saving and loading), then everything becomes fine.

However, if we use Theano as backend, (keep all the code unchanged and change ~/.keras/keras.json to use Theano), then everything will be fine. The reloaded model will do its job correctly.

Have you ever seen such a weird phenomenon? Do you think we have some issue to save the model?

One more information: the way we used multi-gpu for training is directly add “context=['gpu(0)', 'gpu(1)', 'gpu(2)', 'gpu(3)']” when we are compiling the model. I am assuming there is no additional configuration needed.

Please let me know if you need more information.

Score screenshot sample:
same-scores

@sandeep-krishnamurthy
Copy link

Working on this.

@mongoose54
Copy link

mongoose54 commented Dec 7, 2017

I am using save_weights and load_weights but unfortunately when loading weights I get like a shape error. Running latest code. Is there some bug or is it a problem on my side?

How do you run save_weights and load_weights ? Like normally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants