tfjs-node training vs tfjs browser predictions giving NaN

24 views Asked by At

I have a trained classification model in tfjs-node that exports a model.json and weights.bin file. When I execute it from the Terminal it works just fine and returns correct prediction probabilities as 0-1 range. (it works with both tfjs-node and tfjs libraries). Once I move it to the browser, it just returns NaN for all the probabilities with the same input.

tf.getBackend() result is webgl, but the same result is when I set tf.setBackend('cpu')

1

There are 1 answers

0
nxtwrld On

I found the problem in the discrepancy of the data input for normalization used in the node vs browser that led to one of the vectors being NaN. This resulted in the whole model returning NaN predictions. I should have debugged the normalized vectors more thoroughly before posting a question.