In this chapter, we have introduced how to export your trained model in TensorFlow and convert it into a usable format in TensorFlow.js. TensorFlow exports models mainly in two types of formats. One is SavedModel, which is a low-level format but it enables us to flexibly control variable mapping and share it with multiple graph definitions. If you want to construct a serialized model in a sufficiently optimized manner, SavedModel is the one you need to consider. Another format is Keras HDF5. As Keras is a pretty popular framework running on top of TensorFlow, exporting a model in Keras format could be the optimal solution for developers. Thanks to the limited number of configurations we need to set explicitly, that must be the easiest one to export the pretrained model into the file.
An exported file cannot be used directly in TensorFlow.js. There is a tool named tfjs...