Open velociwabbit opened 6 years ago
I have not gotten everything to work yet, but I will say that right now you need to train on keras v2.0.9 Other versions create the 'no layers' error. Good luck with the rest!
Did you find a solution for the error?
If I'm honest, I don't remember if I did.
I do remember making a basic model and bearly training it on every different version of keras until it would be accepted by keras.js, but I don't remember which worked or anything beyond that. I believe the makers of keras changed how they structured the model files a few times throughout development.
I have taken the liberty of adding the save statement to the supplied mnist_cnn.py example found in the repo (see code below)... Although the save option worked and the next step also worked which was
>python encoder.py --name .\my_first.h5 .\my_first.h5
when i went to test the results in a javascript app i encountered this result:
Uncaught (in promise) Error: [Model] Model configuration does not contain any layers. at t (http://localhost:3003/keras.min.js:1:414319) at t (http://localhost:3003/keras.min.js:1:411416) at r (http://localhost:3003/keras.min.js:1:448353) at Generator.i [as _invoke] (http://localhost:3003/keras.min.js:1:449400) at Generator.t.(anonymous function) [as throw] (http://localhost:3003/keras.min.js:1:448532) at i (http://localhost:3003/keras.min.js:1:164739) at s (http://localhost:3003/keras.min.js:1:164860) at <anonymous> 2keras.min.js:1 Uncaught (in promise) Error: [Model] predict() must take an object where the keys are the named inputs of the model: [] at t (http://localhost:3003/keras.min.js:1:419002) at r (http://localhost:3003/keras.min.js:1:448353) at Generator.i [as _invoke] (http://localhost:3003/keras.min.js:1:449400) at Generator.t.(anonymous function) [as next] (http://localhost:3003/keras.min.js:1:448532) at i (http://localhost:3003/keras.min.js:1:164739) at a (http://localhost:3003/keras.min.js:1:164834) at http://localhost:3003/keras.min.js:1:164892 at new Promise (<anonymous>) at t.<anonymous> (http://localhost:3003/keras.min.js:1:164683) at t.e (http://localhost:3003/keras.min.js:1:420220) at mouseUpLeave (http://localhost:3003/kerdex.html:63:60) at HTMLCanvasElement.digcanvas.onmouseup.e (http://localhost:3003/kerdex.html:69:49)
No doubt i have done something silly but I am unsure what it is... I am just trying to confirm that. i can build a bin file that works so that i can implement my own model/app.
the full text of mnist_cnn.py with the extra line model.save('my_first.h5') is included below:
Thanks