Sample codes to train some model with TensorFlow (Keras), to export the trained model, and to import the model to TensorFlow.js.
You need TensorFlow and TensorFlow.js. If you do not have them yet, install them as follows.
pip install tensorflow
pip install tensorflowjs
Train a model and save the trained model.
$ python3 train.py
(snip)
Model was saved.
You will have the following files.
- model.data-00000-of-00001
- model.index
Load the trained model and export it for TensorFlow.js.
$ python3 export.py
(snip)
Model was exported.
Then you will have the following directory which contains the exported model for TensorFlow.js.
model
├── group1-shard1of1.bin
└── model.json
CC0