What is the main difference between .pb format of tensorflow and .h5 format of keras to store models? Is there any reason to choose one over the other?
Different file formats with different characteristics, both used by tensorflow to save models (.h5 specifically by keras).
.pb - protobufIt is a way to store some structured data (in this case a neural network),project is open source and currently overviewed by Google.
person {
name: "John Doe"
email: "[email protected]"
}
Simple class containing two fields, you can load it in one of multiple supported languages (e.g. C++, Go), parse, modify and send to someone else in binary format.
.xml), hence often used for data transfer across the webtf2.0 , you can see official serializing guide
keras's model)SavedModel is conceptually harder to grasp than single fileweights areYou can read about this format here
.h5 - HDF5 binary data formatUsed originally by keras to save models (keras is now officially part of tensorflow). It is less general and more "data-oriented", less programmatic than .pb.
keras etc.)Tensorflow Serving but you can simply convert it to .pb via keras.experimental.export_saved_model(model, 'path_to_saved_model')
Use the simpler one (.h5) if you don't need to productionize your model (or it's reasonably far away). Use .pb if you are going for production or just want to standardize on single format across all tensorflow provided tools.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With