/pages-sample

APPI Software Development Course

Primary LanguagePythonCreative Commons Zero v1.0 UniversalCC0-1.0

MNSIT Check

Summary

Sample codes to train some model with TensorFlow (Keras), to export the trained model, and to import the model to TensorFlow.js.

Usage

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

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

Export the trained model

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

Licence

CC0