Miscellaneous
Last updated
Was this helpful?
Last updated
Was this helpful?
Comparison:
Checkpoint(*.ckpt)
Contains three files normally: model.ckpt.index
model.ckpt.meta
model.ckpt.data-00000-of-00001
Saved by tf.trainer.Saver().save()
, only save the tf.Variables()
, not including graph model, thus impossible to recover a whole graph with ckpt only.
Use saver.restore(session, checkpoint_path)
to restore.
GraphDef(*.pb)
Contains serialized protobuf data and compute graph, but not Variable data.
Can only recover compute graph, need checkpoint to inject data.
FrozenGraphDef is slightly different, since it will convert all Variable to constant values(which can be loaded from checkpoint), usually used as pre-train model.
SavedModel
Combination of checkpoint and GraphDef, plus SignatureDef of input and output variables.
Reference:
Print parameters in checkpoint
Using internal tool -- inspect_checkpoint
:
Using tf.compat.v1.NewCheckpointReader(ckpt_path)
:
Keras save its model in h5 format, so we need to know how to read h5 in python if we only want to search for some specific parameters.
Reference:
Reference: