transcranial / keras-js

Run Keras models in the browser, with GPU support using WebGL
https://transcranial.github.io/keras-js
MIT License
4.96k stars 503 forks source link

model.predict() always outputs same invalid results after deployment #140

Open zjtisme opened 5 years ago

zjtisme commented 5 years ago

Problem Statment:

Goal: Use keras-js (https://github.com/transcranial/keras-js) to do Sentiment Analysis for input summary(NLP).

Developing environment: React 16.6.3

Related Dependencies: keras-js, imdb_bidirectional_lstm.bin(trained model, located in public folder), imdb_dataset_word_index_top20000.json

Problem: The model.predict() function in keras-js always output the same result, regardless what the the actual input is, the output is always 50% after deployment.

It works fine on my machine, I’m using Mac OS. But if we deployed it to Linux server, the problem occurred. We can load all dependencies in Linux server, no error messages, but the prediction results are totally different from that from local machine even we used completely same code. The prediction results in deployed version are always 50%, which is not valid.