TensorFlow.js Part 2 - Convert Model
To follow along you can get the code. If you haven’t done part one you can just use the model
fullyConvolutionalModel from the
I’ve also made a video with pretty much the same content as this post:
To convert the model we have to install TensorFlow.js first.
pip install Tensorflowjs
This allows us to use the
The following assumes that the model was previously saved as a
SavedModel. If you have a
Keras HDF5 model the API is different.
We call the converter with three arguments. We specify the input format as
keras if you have a Keras HDF5 model) and provide the folder where the model is located as input and a folder named
fullyConvolutionalModelTf as output.
tensorflowjs_converter –-input_format=tf_saved_model ./models/fullyConvolutionalModel ./models/fullyConvolutionalModelTfjs
The result is a
.json file which contains the topology of the model and a
.bin file with the weights.