The Keras HDF5 model

Keras is one of the most popular high-level TensorFlow libraries. Most readers may already use Keras in their daily projects. TensorFlow.js also supports model files exported by Keras. Unlike SavedModel, Keras uses HDF5, which is a hierarchical data structure format. It can represent the nested data structure, thus it is very similar to the protocol buffer in that sense.

Here is a simple diagram showing the rough structure of HDF5:

As the Keras API itself is simple, the way to export the model by Keras is also simple. The model created by Keras has a save method. Just calling the API will save the model in HDF5 format: ...

Get Hands-On Machine Learning with TensorFlow.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.